diff options
author | Xin LI <delphij@FreeBSD.org> | 2014-04-03 22:14:18 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2014-04-03 22:14:18 +0000 |
commit | 37c55e8558a48cc4c248246c1075bfb0bc0bf88a (patch) | |
tree | 0918c40bce1647ed0f095d3ad4c7c89ef13dcd20 | |
parent | ee83e77448cf42bf36f5b2dd99a1e865a154d8c3 (diff) | |
download | src-37c55e8558a48cc4c248246c1075bfb0bc0bf88a.tar.gz src-37c55e8558a48cc4c248246c1075bfb0bc0bf88a.zip |
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
Notes
Notes:
svn path=/head/; revision=264089
-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 fdc7ca115ff5..be3d9e5eee4c 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) |