diff options
author | Bart Schaefer <schaefer@ipost.com> | 2020-12-02 20:14:45 -0800 |
---|---|---|
committer | Bart Schaefer <schaefer@ipost.com> | 2020-12-02 20:14:45 -0800 |
commit | 3499a676fa556639545836dbc4855736f61c8789 (patch) | |
tree | 40b5fafddb64ebcd6f310252954c83c550a4ebb9 /Src/Modules/param_private.c | |
parent | d394bb227741f8a3953efee4c74fd7a4a009acd1 (diff) | |
download | zsh-3499a676fa556639545836dbc4855736f61c8789.tar.gz zsh-3499a676fa556639545836dbc4855736f61c8789.tar.xz zsh-3499a676fa556639545836dbc4855736f61c8789.zip |
47704: fix scope for "private -p"
Diffstat (limited to 'Src/Modules/param_private.c')
-rw-r--r-- | Src/Modules/param_private.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Src/Modules/param_private.c b/Src/Modules/param_private.c index 86416c5c5..24545819d 100644 --- a/Src/Modules/param_private.c +++ b/Src/Modules/param_private.c @@ -171,6 +171,7 @@ bin_private(char *nam, char **args, LinkList assigns, Options ops, int func) { int from_typeset = 1; int ofake = fakelevel; /* paranoia in case of recursive call */ + int hasargs = *args != NULL || (assigns && firstnode(assigns)); makeprivate_error = 0; if (!OPT_ISSET(ops, 'P')) { @@ -190,6 +191,9 @@ bin_private(char *nam, char **args, LinkList assigns, Options ops, int func) } ops->ind['g'] = 2; /* force bin_typeset() to behave as "local" */ + if (OPT_ISSET(ops, 'p') || (!hasargs && OPT_ISSET(ops, '+'))) { + return bin_typeset("private", args, assigns, ops, func); + } queue_signals(); fakelevel = locallevel; |