diff options
author | obrien <obrien@FreeBSD.org> | 2001-07-16 01:56:48 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-07-16 01:56:48 +0000 |
commit | facc2592c2eaaa58a400404d1054d28c31cfdeff (patch) | |
tree | 6a4514198d0671e1f3d0eb6cffc254b61453931e | |
parent | 57a68876635a47a73b98c187b885f2fc2608a614 (diff) | |
download | FreeBSD-src-facc2592c2eaaa58a400404d1054d28c31cfdeff.zip FreeBSD-src-facc2592c2eaaa58a400404d1054d28c31cfdeff.tar.gz |
Connect std{in,out,err} to *something* so that "hooks" scripts that write
to std{err,out} will not spam /etc/resolv.conf.
Ted Lemon fixed the problem in version 3 of the client, but only for the
pre-daemonized case. Thanks to Brian for pointing that out and helping
to make our future dhclient (v3) better.
Submitted by: brian
-rw-r--r-- | contrib/isc-dhcp/client/dhclient.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/isc-dhcp/client/dhclient.c b/contrib/isc-dhcp/client/dhclient.c index 69424a8..a84acb3 100644 --- a/contrib/isc-dhcp/client/dhclient.c +++ b/contrib/isc-dhcp/client/dhclient.c @@ -2121,6 +2121,13 @@ int script_go (ip) wstatus = 0; } } else { + if ((i = open(_PATH_DEVNULL, O_RDWR)) != -1) { + dup2(i, STDIN_FILENO); + dup2(i, STDOUT_FILENO); + dup2(i, STDERR_FILENO); + if (i > STDERR_FILENO) + close(i); + } execve (scriptName, argv, envp); error ("execve (%s, ...): %m", scriptName); exit (0); |