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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to