Use O_CLOEXEC for open instead of separate fcntl(2) call.

This commit is contained in:
Pawel Jakub Dawidek 2012-09-22 12:42:51 +00:00
parent 171f6b3a34
commit 901610f4b8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240823

View file

@ -855,11 +855,9 @@ event_loop(void)
timeval tv;
fd_set fds;
fd = open(PATH_DEVCTL, O_RDONLY);
fd = open(PATH_DEVCTL, O_RDONLY | O_CLOEXEC);
if (fd == -1)
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);
max_fd = max(fd, server_fd) + 1;
while (1) {