changeset 11879:bd0609bf2760

Fix test of fcntl's return value.
author Bruno Haible <bruno@clisp.org>
date Sun, 23 Aug 2009 10:20:54 +0200
parents ed51af85012b
children d5e0338c205a
files ChangeLog lib/pipe2.c
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-23  Bruno Haible  <bruno@clisp.org>
+
+	* lib/pipe2.c (pipe2): Fix test of fcntl's return value.
+
 2009-08-23  Bruno Haible  <bruno@clisp.org>
 
 	* modules/fchdir (Depends-on): Use fcntl-h instead of fcntl.
--- a/lib/pipe2.c
+++ b/lib/pipe2.c
@@ -70,9 +70,9 @@
       int fcntl_flags;
 
       if ((fcntl_flags = fcntl (fd[1], F_GETFL, 0)) < 0
-	  || fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) < 0
+	  || fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) == -1
 	  || (fcntl_flags = fcntl (fd[0], F_GETFL, 0)) < 0
-	  || fcntl (fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) < 0)
+	  || fcntl (fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
 	goto fail;
     }
 
@@ -81,9 +81,9 @@
       int fcntl_flags;
 
       if ((fcntl_flags = fcntl (fd[1], F_GETFD, 0)) < 0
-	  || fcntl (fd[1], F_SETFD, fcntl_flags | FD_CLOEXEC) < 0
+	  || fcntl (fd[1], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1
 	  || (fcntl_flags = fcntl (fd[0], F_GETFD, 0)) < 0
-	  || fcntl (fd[0], F_SETFD, fcntl_flags | FD_CLOEXEC) < 0)
+	  || fcntl (fd[0], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
 	goto fail;
     }