summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2001-05-07 23:53:09 +0000
committerEric Andersen2001-05-07 23:53:09 +0000
commit45e92ba2ced91eba4cc432d3addaafdd2a326689 (patch)
treee67716c4d6591466a13d32eed9f5c24acb120b07
parent8cd16d8fd3c790f902bbd057f5399e849a0d4ac5 (diff)
downloadbusybox-45e92ba2ced91eba4cc432d3addaafdd2a326689.zip
busybox-45e92ba2ced91eba4cc432d3addaafdd2a326689.tar.gz
This patch from Evin Robertson <nitfol@my-deja.com> fixes export so it works.
This way leaks memory, but oh well. We will probably fix that when we get around to doing local variables.
-rw-r--r--hush.c5
-rw-r--r--shell/hush.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/hush.c b/hush.c
index e58ac44..a5f634b 100644
--- a/hush.c
+++ b/hush.c
@@ -469,7 +469,10 @@ static int builtin_export(struct child_prog *child)
if (child->argv[1] == NULL) {
return (builtin_env(child));
}
- res = putenv(child->argv[1]);
+ /* FIXME -- I leak memory. This will be
+ * fixed up properly when we add local
+ * variable support -- I hope */
+ res = putenv(strdup(child->argv[1]));
if (res)
fprintf(stderr, "export: %s\n", strerror(errno));
return (res);
diff --git a/shell/hush.c b/shell/hush.c
index e58ac44..a5f634b 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -469,7 +469,10 @@ static int builtin_export(struct child_prog *child)
if (child->argv[1] == NULL) {
return (builtin_env(child));
}
- res = putenv(child->argv[1]);
+ /* FIXME -- I leak memory. This will be
+ * fixed up properly when we add local
+ * variable support -- I hope */
+ res = putenv(strdup(child->argv[1]));
if (res)
fprintf(stderr, "export: %s\n", strerror(errno));
return (res);