Module Name: src
Committed By: christos
Date: Mon Nov 14 18:24:45 UTC 2011
Modified Files:
src/bin/sh: eval.c
Log Message:
PR/45613: Aleksey Cheusov: /bin/sh: 'set -e' + 'if eval false' problem
Fixed from: http://www.freebsd.org/cgi/query-pr.cgi?pr=134881&cat=
To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/bin/sh/eval.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.102 src/bin/sh/eval.c:1.103
--- src/bin/sh/eval.c:1.102 Wed Aug 31 12:24:54 2011
+++ src/bin/sh/eval.c Mon Nov 14 13:24:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: eval.c,v 1.102 2011/08/31 16:24:54 plunky Exp $ */
+/* $NetBSD: eval.c,v 1.103 2011/11/14 18:24:45 christos 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.102 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: eval.c,v 1.103 2011/11/14 18:24:45 christos Exp $");
#endif
#endif /* not lint */
@@ -92,6 +92,7 @@ int evalskip; /* set if we are skippin
STATIC int skipcount; /* number of levels to skip */
MKINIT int loopnest; /* current loop nesting level */
int funcnest; /* depth of function calls */
+STATIC int builtin_flags; /* evalcommand flags for builtins */
const char *commandname;
@@ -181,7 +182,7 @@ evalcmd(int argc, char **argv)
STPUTC('\0', concat);
p = grabstackstr(concat);
}
- evalstring(p, 0);
+ evalstring(p, builtin_flags & EV_TESTED);
}
return exitstatus;
}
@@ -1010,6 +1011,7 @@ normal_fork:
/* and getopt */
optreset = 1;
optind = 1;
+ builtin_flags = flags;
exitstatus = cmdentry.u.bltin(argc, argv);
} else {
e = exception;