summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-11-15 10:33:00 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-11-15 10:33:00 +0000
commitd15adf705c3d6351fd0c729a4623f0aa8eee24a1 (patch)
tree36289c42d4adb1b2988f6979424d975393a70470 /sbin
parentdbf3f704409c52cc7e280b46f951d4fe69a8e2a6 (diff)
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.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhclient/dhclient.c11
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);