From 66ace7e647a12b93fa4cee4669ff1ddea33d0c36 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 12 Dec 2015 19:27:36 +0000 Subject: [PATCH] fix regression introduced with test(1) rewrite in R40d: evaluation errors were not returned any more Bug spotted and patch by Martijn Dekker --- funcs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/funcs.c b/funcs.c index 16fcb0f..2a6fd88 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.287 2015/10/24 19:46:09 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.288 2015/12/12 19:27:36 tg Exp $"); #if HAVE_KILLPG /* @@ -2856,7 +2856,7 @@ c_test(const char **wp) /* * Attempt to conform to POSIX special cases. This is pretty - * dumb code straight-forward from the 2008 spec, but unless + * dumb code straight-forward from the 2008 spec, but unlike * the old pdksh code doesn't live from so many assumptions. * It does, though, inline some calls to '(*te.funcname)()'. */ @@ -2877,6 +2877,8 @@ c_test(const char **wp) ptest_unary: rv = test_eval(&te, op, *te.pos.wp++, NULL, true); ptest_out: + if (te.flags & TEF_ERROR) + return (T_ERR_EXIT); return ((invert & 1) ? rv : !rv); } /* let the parser deal with anything else */