diff options
author | delphij <delphij@FreeBSD.org> | 2014-04-03 22:14:18 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2014-04-03 22:14:18 +0000 |
commit | 727357321cb83a7194c5daea60281f5eb0738c21 (patch) | |
tree | 0918c40bce1647ed0f095d3ad4c7c89ef13dcd20 /sbin | |
parent | 2c5d789700e0e7fadcc4c2957e40806303e165ae (diff) | |
download | FreeBSD-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.c | 3 |
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) |