Fix test of fcntl's return value.
authorBruno Haible <bruno@clisp.org>
Sat, 22 Aug 2009 23:37:15 +0000 (01:37 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 22 Aug 2009 23:37:15 +0000 (01:37 +0200)
ChangeLog
lib/pipe-filter-gi.c
lib/pipe-filter-ii.c

index b8aff86cf5b969b94b0a941647f1381358916abe..5b865c823c0661d1e62c60b15a8e3e7e0525acb5 100644 (file)
--- 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.
index 886820a414edcd7b088a56b11aa1254109952266..340b38af0c42292cf4b3f8cf50e3be761a7d9ecd 100644 (file)
@@ -248,9 +248,9 @@ filter_init (struct pipe_filter_gi *filter)
     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,
index 8281ad0119d6e82d4c80359f19c7405289fb5d44..cbdaf94f6eaf52fe47c02957ceae4aee39509053 100644 (file)
@@ -289,9 +289,9 @@ pipe_filter_ii_execute (const char *progname,
       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,