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
This commit is contained in:
Xin LI 2014-04-03 22:14:18 +00:00
parent ee83e77448
commit 37c55e8558
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264089

View File

@ -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)