diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2011-05-04 22:12:22 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2011-05-04 22:12:22 +0000 |
commit | 3937fc9c265632810745124a6943f5e98d5da4e6 (patch) | |
tree | b5d34d5bbcadf2e334bbcb6aceab0acd2258ee47 /bin/sh/arith_yacc.c | |
parent | 5a816b92a328070ecaa3d0251baea14b9bf906c4 (diff) | |
download | src-3937fc9c265632810745124a6943f5e98d5da4e6.tar.gz src-3937fc9c265632810745124a6943f5e98d5da4e6.zip |
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)
Notes
Notes:
svn path=/head/; revision=221463
Diffstat (limited to 'bin/sh/arith_yacc.c')
-rw-r--r-- | bin/sh/arith_yacc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/arith_yacc.c b/bin/sh/arith_yacc.c index edb321ff05f2..63f236c56116 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; |