Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Apr 2009 19:06:53 +0000 (UTC)
From:      Stefan Farfeleder <stefanf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190698 - head/bin/sh
Message-ID:  <200904041906.n34J6raw078841@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904041906.n34J6raw078841>