Avoid segfault when export is invoked with no arguments. Thanks to
authorMatt Kraai <kraai@debian.org>
Wed, 4 Apr 2001 17:50:04 +0000 (17:50 -0000)
committerMatt Kraai <kraai@debian.org>
Wed, 4 Apr 2001 17:50:04 +0000 (17:50 -0000)
Gennady Feldman.

lash.c
sh.c
shell/lash.c

diff --git a/lash.c b/lash.c
index 28015cb..89325b6 100644 (file)
--- a/lash.c
+++ b/lash.c
@@ -426,6 +426,7 @@ static int builtin_export(struct child_prog *child)
                for (e = environ; *e; e++) {
                        printf( "%s\n", *e);
                }
+               return 0;
        }
        res = putenv(v);
        if (res)
diff --git a/sh.c b/sh.c
index 28015cb..89325b6 100644 (file)
--- a/sh.c
+++ b/sh.c
@@ -426,6 +426,7 @@ static int builtin_export(struct child_prog *child)
                for (e = environ; *e; e++) {
                        printf( "%s\n", *e);
                }
+               return 0;
        }
        res = putenv(v);
        if (res)
index 28015cb..89325b6 100644 (file)
@@ -426,6 +426,7 @@ static int builtin_export(struct child_prog *child)
                for (e = environ; *e; e++) {
                        printf( "%s\n", *e);
                }
+               return 0;
        }
        res = putenv(v);
        if (res)