From 6ef5d068bf7e9e45352363f86c6e795001fc75f7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 23 Aug 2009 10:20:54 +0200 Subject: [PATCH] Fix test of fcntl's return value. --- ChangeLog | 4 ++++ lib/pipe2.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c475641524..868272b551 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-08-23 Bruno Haible + + * lib/pipe2.c (pipe2): Fix test of fcntl's return value. + 2009-08-23 Bruno Haible * modules/fchdir (Depends-on): Use fcntl-h instead of fcntl. diff --git a/lib/pipe2.c b/lib/pipe2.c index 68677deac2..d40c4cda8e 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -70,9 +70,9 @@ pipe2 (int fd[2], int flags) 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 @@ pipe2 (int fd[2], int flags) 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; } -- 2.30.2