diff options
author | Stefan Farfeleder <stefanf@FreeBSD.org> | 2009-04-04 19:06:52 +0000 |
---|---|---|
committer | Stefan Farfeleder <stefanf@FreeBSD.org> | 2009-04-04 19:06:52 +0000 |
commit | 8403b16a590360ee7b75992d3e85326c021f750e (patch) | |
tree | 298931b1c204e7d6707981bdebac84191b59f0b5 | |
parent | bb6418cbe3e6a838bc7bc76049f6fcb9629f602e (diff) | |
download | src-8403b16a590360ee7b75992d3e85326c021f750e.tar.gz src-8403b16a590360ee7b75992d3e85326c021f750e.zip |
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
Notes
Notes:
svn path=/head/; revision=190698
-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 f6b702b3d2b0..26e21489440f 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(); |