summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-05-04 22:12:22 +0000
committerjilles <jilles@FreeBSD.org>2011-05-04 22:12:22 +0000
commitba0d29571f9f8f83653cd0298a96664fe82e0e04 (patch)
treeb5d34d5bbcadf2e334bbcb6aceab0acd2258ee47 /bin
parent48e83eacf3f56abcf0a13583eb07ea21151165b3 (diff)
downloadFreeBSD-src-ba0d29571f9f8f83653cd0298a96664fe82e0e04.zip
FreeBSD-src-ba0d29571f9f8f83653cd0298a96664fe82e0e04.tar.gz
sh: Apply set -u to variables in arithmetic.
Note that this only applies to variables that are actually used. Things like (0 && unsetvar) do not cause an error. Exp-run done by: pav (with some other sh(1) changes)
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/arith_yacc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/arith_yacc.c b/bin/sh/arith_yacc.c
index edb321f..63f236c 100644
--- a/bin/sh/arith_yacc.c
+++ b/bin/sh/arith_yacc.c
@@ -97,6 +97,8 @@ static arith_t arith_lookupvarint(char *varname)
arith_t result;
str = lookupvar(varname);
+ if (uflag && str == NULL)
+ yyerror("variable not set");
if (str == NULL || *str == '\0')
str = "0";
errno = 0;
OpenPOWER on IntegriCloud