From 26d8ca3bc9cafaf8fae8764a6ad2cb3fbb84c8ee Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 15 Oct 2016 13:16:52 +0000 Subject: [PATCH] directly create the socket with SOCK_NONBLOCK instead of calling fcntl(2) --- lib/libdevdctl/consumer.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/libdevdctl/consumer.cc b/lib/libdevdctl/consumer.cc index e76989473599..a9949a6f269a 100644 --- a/lib/libdevdctl/consumer.cc +++ b/lib/libdevdctl/consumer.cc @@ -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(&devdAddr), sLen);