svn commit: r190698 - head/bin/sh

Stefan Farfeleder stefanf at FreeBSD.org
Sat Apr 4 12:06:55 PDT 2009


Author: stefanf
Date: Sat Apr  4 19:06:52 2009
New Revision: 190698
URL: http://svn.freebsd.org/changeset/base/190698

Log:
  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

Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c	Sat Apr  4 17:48:38 2009	(r190697)
+++ head/bin/sh/eval.c	Sat Apr  4 19:06:52 2009	(r190698)
@@ -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();


More information about the svn-src-all mailing list