mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Add checks for failed fcntl calls
This commit is contained in:
parent
aac7f6e8f2
commit
fd2c6c56a5
1 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue