diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/builtin.c | 6 | ||||
-rw-r--r-- | Src/params.c | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index 7013e89af..02f113a31 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2580,8 +2580,10 @@ bin_unset(char *name, char **argv, Options ops, int func) zerrnam(name, "%s: invalid element for unset", s, 0); returnval = 1; } - } else - unsetparam_pm(pm, 0, 1); + } else { + if (unsetparam_pm(pm, 0, 1)) + returnval = 1; + } if (ss) *ss = '['; } diff --git a/Src/params.c b/Src/params.c index 29f6e4072..61aa3456a 100644 --- a/Src/params.c +++ b/Src/params.c @@ -2214,18 +2214,18 @@ unsetparam(char *s) /* Unset a parameter */ /**/ -mod_export void +mod_export int unsetparam_pm(Param pm, int altflag, int exp) { Param oldpm, altpm; if ((pm->flags & PM_READONLY) && pm->level <= locallevel) { zerr("read-only variable: %s", pm->nam, 0); - return; + return 1; } if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) { zerr("%s: restricted", pm->nam, 0); - return; + return 1; } pm->unsetfn(pm, exp); if ((pm->flags & PM_EXPORTED) && pm->env) { @@ -2267,7 +2267,7 @@ unsetparam_pm(Param pm, int altflag, int exp) */ if ((pm->level && locallevel >= pm->level) || (pm->flags & (PM_SPECIAL|PM_REMOVABLE)) == PM_SPECIAL) - return; + return 0; /* remove parameter node from table */ paramtab->removenode(paramtab, pm->nam); @@ -2292,6 +2292,8 @@ unsetparam_pm(Param pm, int altflag, int exp) } paramtab->freenode((HashNode) pm); /* free parameter node */ + + return 0; } /* Standard function to unset a parameter. This is mostly delegated to * |