From: Todd C. Miller Date: Mon, 23 Jan 2017 02:56:13 +0000 (-0800) Subject: Close execfd in parent processes where it is not needed. X-Git-Tag: SUDO_1_8_20^2~131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dde2b5eb2c5fc93218c8ff5f62508fae5057cea9;p=sudo Close execfd in parent processes where it is not needed. --- diff --git a/src/exec.c b/src/exec.c index 56da013c9..f74e73edf 100644 --- a/src/exec.c +++ b/src/exec.c @@ -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); diff --git a/src/exec_pty.c b/src/exec_pty.c index 740350638..fc0f864a4 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -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;