]> granicus.if.org Git - sudo/commitdiff
Close execfd in parent processes where it is not needed.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 23 Jan 2017 02:56:13 +0000 (18:56 -0800)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 23 Jan 2017 02:56:13 +0000 (18:56 -0800)
src/exec.c
src/exec_pty.c

index 56da013c91a0ac0b9a949a1b0cd2601d1e636144..f74e73edf01a68746f8fc850d410a72345dadb84 100644 (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);
index 7403506380730924bea51c3994a65b02bbfb39d0..fc0f864a4ad9bc852ea915737febeeba6ff93a36 100644 (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;