svn commit: r240823 - head/sbin/devd

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Sep 22 12:42:52 UTC 2012


Author: pjd
Date: Sat Sep 22 12:42:51 2012
New Revision: 240823
URL: http://svn.freebsd.org/changeset/base/240823

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

Modified:
  head/sbin/devd/devd.cc

Modified: head/sbin/devd/devd.cc
==============================================================================
--- head/sbin/devd/devd.cc	Sat Sep 22 12:41:49 2012	(r240822)
+++ head/sbin/devd/devd.cc	Sat Sep 22 12:42:51 2012	(r240823)
@@ -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) {


More information about the svn-src-head mailing list