Handle failure of fcntl in Pipe. (Coverity 1241934, 1241935)

This commit is contained in:
Tim Wojtulewicz 2019-09-13 12:41:46 -07:00
parent dddba3432f
commit c009cd3289

View file

@ -19,13 +19,15 @@ static void pipe_fail(int eno)
static void set_flags(int fd, int flags)
{
if ( flags )
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | flags);
if ( fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | flags) == -1 )
pipe_fail(errno);
}
static void set_status_flags(int fd, int flags)
{
if ( flags )
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | flags);
if ( fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | flags) == -1 )
pipe_fail(errno);
}
static int dup_or_fail(int fd, int flags)