mirror of
https://git.busybox.net/busybox
synced 2026-01-31 16:43:21 +00:00
ash: only allow local variables in functions
Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
3f221113a5
commit
ef2386b80a
3 changed files with 5 additions and 0 deletions
|
|
@ -8987,6 +8987,9 @@ localcmd(int argc UNUSED_PARAM, char **argv)
|
|||
{
|
||||
char *name;
|
||||
|
||||
if (!funcnest)
|
||||
ash_msg_and_raise_error("not in a function");
|
||||
|
||||
argv = argptr;
|
||||
while ((name = *argv++) != NULL) {
|
||||
mklocal(name);
|
||||
|
|
|
|||
1
shell/ash_test/ash-misc/local2.right
Normal file
1
shell/ash_test/ash-misc/local2.right
Normal file
|
|
@ -0,0 +1 @@
|
|||
./local2.tests: local: line 1: not in a function
|
||||
1
shell/ash_test/ash-misc/local2.tests
Executable file
1
shell/ash_test/ash-misc/local2.tests
Executable file
|
|
@ -0,0 +1 @@
|
|||
local x=1
|
||||
Loading…
Reference in a new issue