Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2016 13:16:52 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r307364 - head/lib/libdevdctl
Message-ID:  <201610151316.u9FDGqQN046946@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sat Oct 15 13:16:52 2016
New Revision: 307364
URL: https://svnweb.freebsd.org/changeset/base/307364

Log:
  directly create the socket with SOCK_NONBLOCK instead of calling fcntl(2)

Modified:
  head/lib/libdevdctl/consumer.cc

Modified: head/lib/libdevdctl/consumer.cc
==============================================================================
--- head/lib/libdevdctl/consumer.cc	Sat Oct 15 12:42:47 2016	(r307363)
+++ head/lib/libdevdctl/consumer.cc	Sat Oct 15 13:16:52 2016	(r307364)
@@ -108,11 +108,9 @@ Consumer::ConnectToDevd()
 	strlcpy(devdAddr.sun_path, s_devdSockPath, sizeof(devdAddr.sun_path));
 	sLen = SUN_LEN(&devdAddr);
 
-	m_devdSockFD = socket(AF_UNIX, SOCK_SEQPACKET, 0);
+	m_devdSockFD = socket(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK, 0);
 	if (m_devdSockFD == -1)
 		err(1, "Unable to create socket");
-        if (fcntl(m_devdSockFD, F_SETFL, O_NONBLOCK) < 0)
-                err(1, "fcntl");
 	result = connect(m_devdSockFD,
 			 reinterpret_cast<sockaddr *>(&devdAddr),
 			 sLen);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610151316.u9FDGqQN046946>