SHA256
1
0
forked from pool/dhcp
dhcp/dhcp-3.1.1-dhclient-exec-filedes.dif

16 lines
416 B
Plaintext
Raw Normal View History

--- client/dhclient.c
+++ client/dhclient.c 2008/09/08 09:27:16
@@ -2659,6 +2659,12 @@ int script_go (client)
*/
if (leaseFile != NULL)
fclose(leaseFile);
+ if ((i = open("/dev/null", O_RDWR)) != -1) {
+ dup2(i, STDIN_FILENO);
+ dup2(i, STDOUT_FILENO);
+ if (i > STDERR_FILENO)
+ close(i);
+ }
execve (scriptName, argv, envp);
log_error ("execve (%s, ...): %m", scriptName);
exit (0);