diff options
author | 2012-11-15 10:32:59 +0000 | |
---|---|---|
committer | 2012-11-15 10:32:59 +0000 | |
commit | c46b4eb60fd4e4fc6d2e2a06478dbece26d6a373 (patch) | |
tree | 32b4f4df4ba52c44bd19532a54c20b683b6500b3 | |
parent | some formatting/sorting/consistency fixes for "machine"; ok guenther (diff) | |
download | wireguard-openbsd-c46b4eb60fd4e4fc6d2e2a06478dbece26d6a373.tar.xz wireguard-openbsd-c46b4eb60fd4e4fc6d2e2a06478dbece26d6a373.zip |
If '-d' is specified to keep dhclient from daemonizing, don't
redirect privileged child's STDIN/OUT/ERROR to /dev/null. This was
already avoided for the unprivileged process. Makes printf/note
debugging easier.
-rw-r--r-- | sbin/dhclient/dhclient.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index a8bca6daa43..8df84c3810c 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.175 2012/11/14 18:10:45 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.176 2012/11/15 10:32:59 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1706,9 +1706,12 @@ fork_privchld(int fd, int fd2) setproctitle("%s [priv]", ifi->name); - dup2(nullfd, STDIN_FILENO); - dup2(nullfd, STDOUT_FILENO); - dup2(nullfd, STDERR_FILENO); + if (!no_daemon) { + dup2(nullfd, STDIN_FILENO); + dup2(nullfd, STDOUT_FILENO); + dup2(nullfd, STDERR_FILENO); + } + close(nullfd); close(fd2); |