mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 09:50:29 +00:00
io: add io_cloexec to set close-on-exec flag.
This commit is contained in:
parent
1e281a8baa
commit
c135d0dded
@ -785,6 +785,16 @@ io_setnonblock(int fd)
|
||||
return fcntl(fd, F_SETFL, flags) == 0;
|
||||
}
|
||||
|
||||
bool
|
||||
io_setcloexec(int fd)
|
||||
{
|
||||
int flags = fcntl(fd, F_GETFD);
|
||||
if (flags == -1)
|
||||
return false;
|
||||
flags |= FD_CLOEXEC;
|
||||
|
||||
return fcntl(fd, F_SETFD, flags) == 0;
|
||||
}
|
||||
|
||||
bool
|
||||
io_close(int fd)
|
||||
|
@ -45,6 +45,9 @@ bool io_close PARAMS((int fd));
|
||||
/* set O_NONBLOCK */
|
||||
bool io_setnonblock PARAMS((int fd));
|
||||
|
||||
/* set O_CLOEXEC */
|
||||
bool io_setcloexec PARAMS((int fd));
|
||||
|
||||
/* watch fds for activity */
|
||||
int io_dispatch PARAMS((struct timeval *tv));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user