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();
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to