aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 0490f7f7d..b404449d0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5462,16 +5462,6 @@ popredir(int drop, int restore)
5462 * Undo all redirections. Called on error or interrupt. 5462 * Undo all redirections. Called on error or interrupt.
5463 */ 5463 */
5464 5464
5465/*
5466 * Discard all saved file descriptors.
5467 */
5468static void
5469clearredir(int drop)
5470{
5471 while (redirlist)
5472 popredir(drop, /*restore:*/ 0);
5473}
5474
5475static int 5465static int
5476redirectsafe(union node *redir, int flags) 5466redirectsafe(union node *redir, int flags)
5477{ 5467{
@@ -7559,7 +7549,6 @@ shellexec(char **argv, const char *path, int idx)
7559 int exerrno; 7549 int exerrno;
7560 int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */ 7550 int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */
7561 7551
7562 clearredir(/*drop:*/ 1);
7563 envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL); 7552 envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
7564 if (strchr(argv[0], '/') != NULL 7553 if (strchr(argv[0], '/') != NULL
7565#if ENABLE_FEATURE_SH_STANDALONE 7554#if ENABLE_FEATURE_SH_STANDALONE
@@ -10191,7 +10180,6 @@ closescript(void)
10191static void 10180static void
10192setinputfd(int fd, int push) 10181setinputfd(int fd, int push)
10193{ 10182{
10194 close_on_exec_on(fd);
10195 if (push) { 10183 if (push) {
10196 pushfile(); 10184 pushfile();
10197 g_parsefile->buf = NULL; 10185 g_parsefile->buf = NULL;
@@ -10223,6 +10211,8 @@ setinputfile(const char *fname, int flags)
10223 } 10211 }
10224 if (fd < 10) 10212 if (fd < 10)
10225 fd = savefd(fd); 10213 fd = savefd(fd);
10214 else
10215 close_on_exec_on(fd);
10226 setinputfd(fd, flags & INPUT_PUSH_FILE); 10216 setinputfd(fd, flags & INPUT_PUSH_FILE);
10227 out: 10217 out:
10228 INT_ON; 10218 INT_ON;
@@ -13339,7 +13329,8 @@ reset(void)
13339 tokpushback = 0; 13329 tokpushback = 0;
13340 checkkwd = 0; 13330 checkkwd = 0;
13341 /* from redir.c: */ 13331 /* from redir.c: */
13342 clearredir(/*drop:*/ 0); 13332 while (redirlist)
13333 popredir(/*drop:*/ 0, /*restore:*/ 0);
13343} 13334}
13344 13335
13345#if PROFILE 13336#if PROFILE