Close execfd in parent processes where it is not needed.
This commit is contained in:
@@ -455,6 +455,12 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
|
||||
child = fork_cmnd(details, sv);
|
||||
close(sv[1]);
|
||||
|
||||
/* No longer need execfd. */
|
||||
if (details->execfd != -1) {
|
||||
close(details->execfd);
|
||||
details->execfd = -1;
|
||||
}
|
||||
|
||||
/* Set command timeout if specified. */
|
||||
if (ISSET(details->flags, CD_SET_TIMEOUT))
|
||||
alarm(details->timeout);
|
||||
|
@@ -1450,6 +1450,12 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
}
|
||||
close(errpipe[1]);
|
||||
|
||||
/* No longer need execfd. */
|
||||
if (details->execfd != -1) {
|
||||
close(details->execfd);
|
||||
details->execfd = -1;
|
||||
}
|
||||
|
||||
/* Send the command's pid to main sudo process. */
|
||||
cstat.type = CMD_PID;
|
||||
cstat.val = cmnd_pid;
|
||||
|
Reference in New Issue
Block a user