Merge pull request #2375 from hardening/minimize_diff
Check return value for fcntl()
This commit is contained in:
commit
cc0db37725
@ -452,13 +452,16 @@ BOOL SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCol
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
flags = fcntl(fd, F_GETFL);
|
flags = fcntl(fd, F_GETFL);
|
||||||
|
if (flags < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (pNamedPipe->dwPipeMode & PIPE_NOWAIT)
|
if (pNamedPipe->dwPipeMode & PIPE_NOWAIT)
|
||||||
flags = (flags | O_NONBLOCK);
|
flags = (flags | O_NONBLOCK);
|
||||||
else
|
else
|
||||||
flags = (flags & ~(O_NONBLOCK));
|
flags = (flags & ~(O_NONBLOCK));
|
||||||
|
|
||||||
fcntl(fd, F_SETFL, flags);
|
if (fcntl(fd, F_SETFL, flags) < 0)
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpMaxCollectionCount)
|
if (lpMaxCollectionCount)
|
||||||
|
Loading…
Reference in New Issue
Block a user