diff --git a/src/Pipe.cc b/src/Pipe.cc index f388366c5d..5a0916a3dd 100644 --- a/src/Pipe.cc +++ b/src/Pipe.cc @@ -24,6 +24,9 @@ static int set_flags(int fd, int flags) { auto rval = fcntl(fd, F_GETFD); + if ( rval == -1 ) + pipe_fail(errno); + if ( flags ) { rval |= flags; @@ -39,6 +42,9 @@ static int unset_flags(int fd, int flags) { auto rval = fcntl(fd, F_GETFD); + if ( rval == -1 ) + pipe_fail(errno); + if ( flags ) { rval &= ~flags; @@ -54,6 +60,9 @@ static int set_status_flags(int fd, int flags) { auto rval = fcntl(fd, F_GETFL); + if ( rval == -1 ) + pipe_fail(errno); + if ( flags ) { rval |= flags;