From ba0d29571f9f8f83653cd0298a96664fe82e0e04 Mon Sep 17 00:00:00 2001 From: jilles Date: Wed, 4 May 2011 22:12:22 +0000 Subject: 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) --- bin/sh/arith_yacc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bin') 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; -- cgit v1.1