summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-04-03 22:14:18 +0000
committerdelphij <delphij@FreeBSD.org>2014-04-03 22:14:18 +0000
commit727357321cb83a7194c5daea60281f5eb0738c21 (patch)
tree0918c40bce1647ed0f095d3ad4c7c89ef13dcd20 /sbin
parent2c5d789700e0e7fadcc4c2957e40806303e165ae (diff)
downloadFreeBSD-src-727357321cb83a7194c5daea60281f5eb0738c21.zip
FreeBSD-src-727357321cb83a7194c5daea60281f5eb0738c21.tar.gz
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
Diffstat (limited to 'sbin')
-rw-r--r--sbin/casperd/zygote.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/casperd/zygote.c b/sbin/casperd/zygote.c
index fdc7ca1..be3d9e5 100644
--- a/sbin/casperd/zygote.c
+++ b/sbin/casperd/zygote.c
@@ -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)
OpenPOWER on IntegriCloud