sh: Clean a readonly local, even if the variable does not exist outside.
If a local variable has been made read-only, this should not prevent its removal when the function returns.
This commit is contained in:
parent
e270f2d00e
commit
e81a328bbd
@ -113,6 +113,7 @@ FILES+= local3.0
|
||||
FILES+= local4.0
|
||||
FILES+= local5.0
|
||||
FILES+= local6.0
|
||||
FILES+= local7.0
|
||||
.if ${MK_NLS} != "no"
|
||||
FILES+= locale1.0
|
||||
.endif
|
||||
|
10
bin/sh/tests/builtins/local7.0
Normal file
10
bin/sh/tests/builtins/local7.0
Normal file
@ -0,0 +1,10 @@
|
||||
# $FreeBSD$
|
||||
|
||||
f() {
|
||||
local x
|
||||
readonly x=2
|
||||
}
|
||||
unset x
|
||||
f
|
||||
x=4
|
||||
[ "$x" = 4 ]
|
@ -802,6 +802,7 @@ poplocalvars(void)
|
||||
ckfree(lvp->text);
|
||||
optschanged();
|
||||
} else if ((lvp->flags & (VUNSET|VSTRFIXED)) == VUNSET) {
|
||||
vp->flags &= ~VREADONLY;
|
||||
(void)unsetvar(vp->text);
|
||||
} else {
|
||||
islocalevar = (vp->flags | lvp->flags) & VEXPORT &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user