diff options
author | stefanf <stefanf@FreeBSD.org> | 2009-04-04 19:06:52 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2009-04-04 19:06:52 +0000 |
commit | c2315973b790ec413c207ed460217fb5444519b2 (patch) | |
tree | 298931b1c204e7d6707981bdebac84191b59f0b5 /bin | |
parent | 51a543ed33dfc41564d2e4fd6fd7f28a5b910506 (diff) | |
download | FreeBSD-src-c2315973b790ec413c207ed460217fb5444519b2.zip FreeBSD-src-c2315973b790ec413c207ed460217fb5444519b2.tar.gz |
Don't let trailing empty lines overwrite the result of the last command with 0.
This affects the built-ins eval, fc, and trap and also the string passed to sh
with the -c option.
Submitted by: Jilles Tjoelker
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/eval.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index f6b702b..26e2148 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -166,7 +166,8 @@ evalstring(char *s) setstackmark(&smark); setinputstring(s, 1); while ((n = parsecmd(0)) != NEOF) { - evaltree(n, 0); + if (n != NULL) + evaltree(n, 0); popstackmark(&smark); } popfile(); |