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
This commit is contained in:
obrien 2001-07-16 01:56:48 +00:00
parent b1cf415d98
commit 0f670892ec

View File

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