poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED 1/2] poked: Fix invalid use of fcntl F_SETFL.


From: Mohammad-Reza Nabipoor
Subject: [COMMITTED 1/2] poked: Fix invalid use of fcntl F_SETFL.
Date: Tue, 24 Jan 2023 09:22:39 +0100

From: Bruno Haible <bruno@clisp.org>

* poked/usock.c (usock_new): Change the CLOEXEC flag through fcntl F_SETFD,
not fcntl F_SETFL.
---
 poked/usock.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/poked/usock.c b/poked/usock.c
index 48efef6b..28559b59 100644
--- a/poked/usock.c
+++ b/poked/usock.c
@@ -635,15 +635,19 @@ usock_new (const char *path)
   u->pipefd[1] = -1;
   if (pipe (u->pipefd) == -1)
     goto error;
-  if (fcntl (u->pipefd[0], F_SETFL, O_NONBLOCK | O_CLOEXEC) == -1)
+  if (fcntl (u->pipefd[0], F_SETFD, FD_CLOEXEC) == -1)
     goto error;
-  if (fcntl (u->pipefd[1], F_SETFL, O_CLOEXEC) == -1)
+  if (fcntl (u->pipefd[1], F_SETFD, FD_CLOEXEC) == -1)
+    goto error;
+  if (fcntl (u->pipefd[0], F_SETFL, O_NONBLOCK) == -1)
     goto error;
 
   if ((u->fd = socket (AF_UNIX, SOCK_STREAM, 0)) == -1)
     goto error;
 
-  if (fcntl (u->fd, F_SETFL, O_NONBLOCK | O_CLOEXEC) == -1)
+  if (fcntl (u->fd, F_SETFD, FD_CLOEXEC) == -1)
+    goto error;
+  if (fcntl (u->fd, F_SETFL, O_NONBLOCK) == -1)
     goto error;
 
   memset (&adr, 0, sizeof (adr));
-- 
2.39.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]