svn commit: r301844 - head/lib/libcasper/libcasper

Mariusz Zaborski oshogbo at FreeBSD.org
Mon Jun 13 00:03:56 UTC 2016


Author: oshogbo
Date: Mon Jun 13 00:03:55 2016
New Revision: 301844
URL: https://svnweb.freebsd.org/changeset/base/301844

Log:
  Don't close fd if it's lower then stderr, otherwise we can close
  one of the descriptor which we just set.
  
  Pointed out by:		jilles
  Approved by:		re (hrs)

Modified:
  head/lib/libcasper/libcasper/service.c

Modified: head/lib/libcasper/libcasper/service.c
==============================================================================
--- head/lib/libcasper/libcasper/service.c	Sun Jun 12 23:34:48 2016	(r301843)
+++ head/lib/libcasper/libcasper/service.c	Mon Jun 13 00:03:55 2016	(r301844)
@@ -360,7 +360,8 @@ stdnull(void)
 	if (dup2(fd, STDERR_FILENO) == -1)
 		errx(1, "Unable to cover stderr");
 
-	close(fd);
+	if (fd > STDERR_FILENO)
+		close(fd);
 }
 
 static void


More information about the svn-src-head mailing list