Close execfd in parent processes where it is not needed.

This commit is contained in:
Todd C. Miller
2017-01-22 18:56:13 -08:00
parent 5514ea6851
commit dde2b5eb2c
2 changed files with 12 additions and 0 deletions

View File

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

View File

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