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

This commit is contained in:
Baptiste Daroussin 2016-10-15 13:16:52 +00:00
parent 963d6c18f4
commit 26d8ca3bc9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=307364

View file

@ -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);