svn commit: r264089 - head/sbin/casperd
Xin LI
delphij at FreeBSD.org
Thu Apr 3 22:14:19 UTC 2014
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)
More information about the svn-src-all
mailing list