Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2014 22:14:19 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264089 - head/sbin/casperd
Message-ID:  <201404032214.s33MEJgp021736@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Apr  3 22:14:18 2014
New Revision: 264089
URL: http://svnweb.freebsd.org/changeset/base/264089

Log:
  Detach from controlling session of parent.  This is similar
  to what is done in daemon(3), which we can not use directly
  in this context.
  
  Reviewed by:	pjd
  MFC after:	2 weeks

Modified:
  head/sbin/casperd/zygote.c

Modified: head/sbin/casperd/zygote.c
==============================================================================
--- head/sbin/casperd/zygote.c	Thu Apr  3 21:39:59 2014	(r264088)
+++ head/sbin/casperd/zygote.c	Thu Apr  3 22:14:18 2014	(r264089)
@@ -63,6 +63,9 @@ stdnull(void)
 	if (fd == -1)
 		errx(1, "Unable to open %s", _PATH_DEVNULL);
 
+	if (setsid() == -1)
+		errx(1, "Unable to detach from session");
+
 	if (dup2(fd, STDIN_FILENO) == -1)
 		errx(1, "Unable to cover stdin");
 	if (dup2(fd, STDOUT_FILENO) == -1)



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