mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-29 08:02:08 +00:00
BUILD: fd: disguise the fd_set_nonblock/cloexec result
We thought that we could get rid of some DISGUISE() with commit a80e4a354
("MINOR: fd: add functions to set O_NONBLOCK and FD_CLOEXEC") thanks to
the calls being in a function but that was without counting on Coverity.
Let's put it directly in the function since most if not all callers don't
care about this result.
This commit is contained in:
parent
77b3db0fbd
commit
974358954b
15
src/fd.c
15
src/fd.c
@ -363,17 +363,22 @@ void fd_delete(int fd)
|
||||
_fd_delete_orphan(fd);
|
||||
}
|
||||
|
||||
/* makes the new fd non-blocking and clears all other O_* flags;
|
||||
* this is meant to be used on new FDs. Returns -1 on failure.
|
||||
/* makes the new fd non-blocking and clears all other O_* flags; this is meant
|
||||
* to be used on new FDs. Returns -1 on failure. The result is disguised at the
|
||||
* end because some callers need to be able to ignore it regardless of the libc
|
||||
* attributes.
|
||||
*/
|
||||
int fd_set_nonblock(int fd)
|
||||
{
|
||||
int ret = fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
|
||||
return ret;
|
||||
return DISGUISE(ret);
|
||||
}
|
||||
|
||||
/* sets the close-on-exec flag on fd; returns -1 on failure. */
|
||||
/* sets the close-on-exec flag on fd; returns -1 on failure. The result is
|
||||
* disguised at the end because some callers need to be able to ignore it
|
||||
* regardless of the libc attributes.
|
||||
*/
|
||||
int fd_set_cloexec(int fd)
|
||||
{
|
||||
int flags, ret;
|
||||
@ -381,7 +386,7 @@ int fd_set_cloexec(int fd)
|
||||
flags = fcntl(fd, F_GETFD);
|
||||
flags |= FD_CLOEXEC;
|
||||
ret = fcntl(fd, F_SETFD, flags);
|
||||
return ret;
|
||||
return DISGUISE(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user