From 8403b16a590360ee7b75992d3e85326c021f750e Mon Sep 17 00:00:00 2001 From: Stefan Farfeleder Date: Sat, 4 Apr 2009 19:06:52 +0000 Subject: [PATCH] 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 --- bin/sh/eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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();