Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh Another fix from FreeBSD (this one from April 2009).
details: https://anonhg.NetBSD.org/src/rev/57ad7a9a8633
branches: trunk
changeset: 354500:57ad7a9a8633
user: kre <kre%NetBSD.org@localhost>
date: Mon Jun 19 03:21:31 2017 +0000
description:
Another fix from FreeBSD (this one from April 2009).
When processing a string (as in eval, trap, or sh -c) don't allow
trailing \n's to destroy the exit status of the last command executed.
That is:
sh -c 'false
'
echo $?
should produce 1, not 0.
diffstat:
bin/sh/eval.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r f564262488b7 -r 57ad7a9a8633 bin/sh/eval.c
--- a/bin/sh/eval.c Mon Jun 19 02:51:51 2017 +0000
+++ b/bin/sh/eval.c Mon Jun 19 03:21:31 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eval.c,v 1.149 2017/06/19 02:51:51 kre Exp $ */
+/* $NetBSD: eval.c,v 1.150 2017/06/19 03:21:31 kre Exp $ */
/*-
* Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
#else
-__RCSID("$NetBSD: eval.c,v 1.149 2017/06/19 02:51:51 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.150 2017/06/19 03:21:31 kre Exp $");
#endif
#endif /* not lint */
@@ -220,7 +220,7 @@
while ((n = parsecmd(0)) != NEOF) {
XTRACE(DBG_EVAL, ("evalstring: "), showtree(n));
- if (nflag == 0)
+ if (n && nflag == 0)
evaltree(n, flag | EV_MORE);
popstackmark(&smark);
}
Home |
Main Index |
Thread Index |
Old Index