aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/var.c
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2014-03-27 22:52:26 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2014-03-27 22:52:26 +0000
commit89d4f883a48d04fadec712f124a80ea13268d989 (patch)
tree3707c01f1bc7fd0c5e4df96dc6012035f0994684 /bin/sh/var.c
parentcf321a51b19bb685eb0bb536b62a429e6866e872 (diff)
downloadsrc-89d4f883a48d04fadec712f124a80ea13268d989.tar.gz
src-89d4f883a48d04fadec712f124a80ea13268d989.zip
Notes
Diffstat (limited to 'bin/sh/var.c')
-rw-r--r--bin/sh/var.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 6c0685f06ded..da13de7f2ce8 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -325,8 +325,11 @@ setvareq(char *s, int flags)
mklocal(s);
vp = find_var(s, &vpp, &nlen);
if (vp != NULL) {
- if (vp->flags & VREADONLY)
+ if (vp->flags & VREADONLY) {
+ if ((flags & (VTEXTFIXED|VSTACK)) == 0)
+ ckfree(s);
error("%.*s: is read only", vp->name_len, s);
+ }
if (flags & VNOSET)
return;
INTOFF;