From: Bruno Haible Date: Sat, 22 Aug 2009 23:37:15 +0000 (+0200) Subject: Fix test of fcntl's return value. X-Git-Tag: v0.1~5614 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=27089d6d0d388650eb8380ee178458700ffc3bcf;p=gnulib.git Fix test of fcntl's return value. --- diff --git a/ChangeLog b/ChangeLog index b8aff86cf..5b865c823 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-08-22 Bruno Haible + * 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 + * lib/pipe.c (create_pipe): Use pipe2 instead of _pipe. * modules/pipe (Depends-on): Add pipe2. diff --git a/lib/pipe-filter-gi.c b/lib/pipe-filter-gi.c index 886820a41..340b38af0 100644 --- a/lib/pipe-filter-gi.c +++ b/lib/pipe-filter-gi.c @@ -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, diff --git a/lib/pipe-filter-ii.c b/lib/pipe-filter-ii.c index 8281ad011..cbdaf94f6 100644 --- a/lib/pipe-filter-ii.c +++ b/lib/pipe-filter-ii.c @@ -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,