summaryrefslogtreecommitdiff
path: root/sh.c
diff options
context:
space:
mode:
authorMatt Kraai2000-09-13 03:43:36 +0000
committerMatt Kraai2000-09-13 03:43:36 +0000
commitdd450a0dedf50067e97e4725e1303758746ddca8 (patch)
tree4d331a535dede5a9e13a01dc417d813f255e51f9 /sh.c
parent322ae93a5e0b78b65831f9fd87fd456eb84d21a1 (diff)
downloadbusybox-dd450a0dedf50067e97e4725e1303758746ddca8.zip
busybox-dd450a0dedf50067e97e4725e1303758746ddca8.tar.gz
Don't fork for the . (source) command so that environment settings are
preserved.
Diffstat (limited to 'sh.c')
-rw-r--r--sh.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sh.c b/sh.c
index 9f67f1c..cd27e46 100644
--- a/sh.c
+++ b/sh.c
@@ -145,6 +145,7 @@ static struct builtInCommand bltins[] = {
{"export", "Set environment variable", builtin_export},
{"unset", "Unset environment variable", builtin_unset},
{"read", "Input environment variable", builtin_read},
+ {".", "Source-in and run commands in a file", builtin_source},
#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
{"if", NULL, builtin_if},
{"then", NULL, builtin_then},
@@ -159,7 +160,6 @@ static struct builtInCommand bltins[] = {
static struct builtInCommand bltins_forking[] = {
{"env", "Print all environment variables", builtin_env},
{"pwd", "Print current directory", builtin_pwd},
- {".", "Source-in and run commands in a file", builtin_source},
{"help", "List shell built-in commands", builtin_help},
{NULL, NULL, NULL}
};
@@ -500,6 +500,7 @@ static int builtin_source(struct job *cmd, struct jobSet *junk)
/* Now run the file */
status = busy_loop(input);
+ fclose(input);
return (status);
}