Close open files before calling builtin_exec(). I've tested this
authorEric Andersen <andersen@codepoet.org>
Tue, 6 Mar 2001 20:28:22 +0000 (20:28 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 6 Mar 2001 20:28:22 +0000 (20:28 -0000)
and it fixes bug #1121.
 -Erik

lash.c
sh.c
shell/lash.c

diff --git a/lash.c b/lash.c
index 077cb1182a102bf05d53d832b026a7457a10fbde..57d969e40a235ce7a92410469779f44c3c47a704 100644 (file)
--- a/lash.c
+++ b/lash.c
@@ -300,6 +300,7 @@ static int builtin_exec(struct child_prog *child)
        if (child->argv[1] == NULL)
                return EXIT_SUCCESS;   /* Really? */
        child->argv++;
+       close_all();
        pseudo_exec(child);
        /* never returns */
 }
diff --git a/sh.c b/sh.c
index 077cb1182a102bf05d53d832b026a7457a10fbde..57d969e40a235ce7a92410469779f44c3c47a704 100644 (file)
--- a/sh.c
+++ b/sh.c
@@ -300,6 +300,7 @@ static int builtin_exec(struct child_prog *child)
        if (child->argv[1] == NULL)
                return EXIT_SUCCESS;   /* Really? */
        child->argv++;
+       close_all();
        pseudo_exec(child);
        /* never returns */
 }
index 077cb1182a102bf05d53d832b026a7457a10fbde..57d969e40a235ce7a92410469779f44c3c47a704 100644 (file)
@@ -300,6 +300,7 @@ static int builtin_exec(struct child_prog *child)
        if (child->argv[1] == NULL)
                return EXIT_SUCCESS;   /* Really? */
        child->argv++;
+       close_all();
        pseudo_exec(child);
        /* never returns */
 }