diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-12-01 11:59:45 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-12-01 11:59:45 +0000 |
commit | fd3862e8ab7520791469867bcfc1dfebd261db3a (patch) | |
tree | 5261ddf6fddb70daf0f80ae030e2bb348234e94e | |
parent | 771ccfa2d8a678f3dded942dd44895d20ee92501 (diff) |
Make privileged process daemonize too. Using same function as the
non-privileged process, go_daemon().
As pointed out by kettenis@, otherwise it is still attached to a
controlling terminal and subject to the dangers thereof. Prep for
having the privileged process pay attention to signals.
-rw-r--r-- | sbin/dhclient/dhclient.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 335833b125e..e2952110ade 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.183 2012/11/29 14:13:31 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.184 2012/12/01 11:59:44 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1713,13 +1713,8 @@ fork_privchld(int fd, int fd2) setproctitle("%s [priv]", ifi->name); - if (!no_daemon) { - dup2(nullfd, STDIN_FILENO); - dup2(nullfd, STDOUT_FILENO); - dup2(nullfd, STDERR_FILENO); - } + go_daemon(); - close(nullfd); close(fd2); if ((priv_ibuf = malloc(sizeof(struct imsgbuf))) == NULL) |