changeset 11873:9823635e7b7a

Fix test of fcntl's return value.
author Bruno Haible <bruno@clisp.org>
date Sun, 23 Aug 2009 01:37:15 +0200
parents 2770463da68f
children dc31add18818
files ChangeLog lib/pipe-filter-gi.c lib/pipe-filter-ii.c
diffstat 3 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-22  Bruno Haible  <bruno@clisp.org>
+
+	* lib/pipe-filter-ii.c (pipe_filter_ii_execute): Fix test of fcntl's
+	return value.
+	* lib/pipe-filter-gi.c (filter_init): Likewise.
+	Reported by Eric Blake.
+
 2009-08-22  Bruno Haible  <bruno@clisp.org>
 
 	* lib/pipe.c (create_pipe): Use pipe2 instead of _pipe.
--- a/lib/pipe-filter-gi.c
+++ b/lib/pipe-filter-gi.c
@@ -248,9 +248,9 @@
     int fcntl_flags;
 
     if ((fcntl_flags = fcntl (filter->fd[1], F_GETFL, 0)) < 0
-	|| fcntl (filter->fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) < 0
+	|| fcntl (filter->fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) == -1
 	|| (fcntl_flags = fcntl (filter->fd[0], F_GETFL, 0)) < 0
-	|| fcntl (filter->fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) < 0)
+	|| fcntl (filter->fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
       {
 	if (filter->exit_on_error)
 	  error (EXIT_FAILURE, errno,
--- a/lib/pipe-filter-ii.c
+++ b/lib/pipe-filter-ii.c
@@ -289,9 +289,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)
 	{
 	  if (exit_on_error)
 	    error (EXIT_FAILURE, errno,