Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Sep 2012 12:42:51 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240823 - head/sbin/devd
Message-ID:  <201209221242.q8MCgpGp068110@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209221242.q8MCgpGp068110>