Use O_CLOEXEC for open instead of separate fcntl(2) call.
This commit is contained in:
parent
171f6b3a34
commit
901610f4b8
@ -855,11 +855,9 @@ event_loop(void)
|
|||||||
timeval tv;
|
timeval tv;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
|
|
||||||
fd = open(PATH_DEVCTL, O_RDONLY);
|
fd = open(PATH_DEVCTL, O_RDONLY | O_CLOEXEC);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
err(1, "Can't open devctl device %s", PATH_DEVCTL);
|
err(1, "Can't open devctl device %s", PATH_DEVCTL);
|
||||||
if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0)
|
|
||||||
err(1, "Can't set close-on-exec flag on devctl");
|
|
||||||
server_fd = create_socket(PIPE);
|
server_fd = create_socket(PIPE);
|
||||||
max_fd = max(fd, server_fd) + 1;
|
max_fd = max(fd, server_fd) + 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user