aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Farfeleder <stefanf@FreeBSD.org>2009-04-04 19:06:52 +0000
committerStefan Farfeleder <stefanf@FreeBSD.org>2009-04-04 19:06:52 +0000
commit8403b16a590360ee7b75992d3e85326c021f750e (patch)
tree298931b1c204e7d6707981bdebac84191b59f0b5
parentbb6418cbe3e6a838bc7bc76049f6fcb9629f602e (diff)
downloadsrc-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.c3
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();