From: Todd C. Miller <Todd.Miller@courtesan.com>
Date: Tue, 7 Sep 2004 17:31:54 +0000 (+0000)
Subject: closefrom() is overkill, the only extra fds are the ones we opened so
X-Git-Tag: SUDO_1_6_8p1~35
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47d25da64b0557b92af240ab96331e0dd1108abd;p=sudo

closefrom() is overkill, the only extra fds are the ones we opened so
just close those in the child.
---

diff --git a/sudo_edit.c b/sudo_edit.c
index a5fefc4d2..95a1e8bd0 100644
--- a/sudo_edit.c
+++ b/sudo_edit.c
@@ -213,7 +213,8 @@ int sudo_edit(argc, argv)
 	(void) sigaction(SIGINT, &saved_sa_int, NULL);
 	(void) sigaction(SIGQUIT, &saved_sa_quit, NULL);
 	(void) sigaction(SIGCHLD, &saved_sa_chld, NULL);
-	closefrom(STDERR_FILENO + 1);
+	for (i = 0; i < argc - 1; i++)
+	    close(tf[i].tfd);
 	set_perms(PERM_FULL_USER);
 	execvp(nargv[0], nargv);
 	warn("unable to execute %s", nargv[0]);