svn commit: r299359 - head/usr.sbin/powerd

Baptiste Daroussin bapt at FreeBSD.org
Tue May 10 11:18:54 UTC 2016


Author: bapt
Date: Tue May 10 11:18:53 2016
New Revision: 299359
URL: https://svnweb.freebsd.org/changeset/base/299359

Log:
  Directly set the NONBLOCK flags when creating the socket
  
  No functional changes

Modified:
  head/usr.sbin/powerd/powerd.c

Modified: head/usr.sbin/powerd/powerd.c
==============================================================================
--- head/usr.sbin/powerd/powerd.c	Tue May 10 11:17:36 2016	(r299358)
+++ head/usr.sbin/powerd/powerd.c	Tue May 10 11:18:53 2016	(r299359)
@@ -379,7 +379,7 @@ devd_init(void)
 	struct sockaddr_un devd_addr;
 
 	bzero(&devd_addr, sizeof(devd_addr));
-	if ((devd_pipe = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
+	if ((devd_pipe = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0)) < 0) {
 		if (vflag)
 			warn("%s(): socket()", __func__);
 		return (-1);
@@ -396,13 +396,6 @@ devd_init(void)
 		return (-1);
 	}
 
-	if (fcntl(devd_pipe, F_SETFL, O_NONBLOCK) == -1) {
-		if (vflag)
-			warn("%s(): fcntl()", __func__);
-		close(devd_pipe);
-		return (-1);
-	}
-
 	return (devd_pipe);
 }
 


More information about the svn-src-head mailing list