From dde2b5eb2c5fc93218c8ff5f62508fae5057cea9 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 22 Jan 2017 18:56:13 -0800 Subject: [PATCH] Close execfd in parent processes where it is not needed. --- src/exec.c | 6 ++++++ src/exec_pty.c | 6 ++++++ 2 files changed, 12 insertions(+) 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; -- 2.50.1