diff options
author | jilles <jilles@FreeBSD.org> | 2011-01-01 13:26:18 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-01-01 13:26:18 +0000 |
commit | 939106871155409dce420e35c6794821dd375a48 (patch) | |
tree | 9ba2056874948170151c7134c7d81e6ce37af27b /bin/sh/eval.c | |
parent | 8229c0275d7cf8c5a2cd1e09ddcc3c74e9fafcfb (diff) | |
download | FreeBSD-src-939106871155409dce420e35c6794821dd375a48.zip FreeBSD-src-939106871155409dce420e35c6794821dd375a48.tar.gz |
sh: Check readonly status for assignments on regular builtins.
An error message is written, the builtin is not executed, nonzero exit
status is returned but the shell does not abort.
This was already checked for special builtins and external commands, with
the same consequences except that the shell aborts for special builtins.
Obtained from: NetBSD
Diffstat (limited to 'bin/sh/eval.c')
-rw-r--r-- | bin/sh/eval.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 25c3fcf..14dd15f 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -997,8 +997,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) */ if (argc == 0 && !(flags & EV_BACKCMD)) cmdentry.special = 1; - if (cmdentry.special) - listsetvar(cmdenviron); + listsetvar(cmdenviron, cmdentry.special ? 0 : VNOSET); if (argc > 0) bltinsetlocale(); commandname = argv[0]; |