Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jun 2016 00:03:55 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301844 - head/lib/libcasper/libcasper
Message-ID:  <201606130003.u5D03txm021131@repo.freebsd.org>

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



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