about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-04-04 16:46:25 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-04-04 16:46:25 +0000
commit06b04ca1b2d7dcbc77787a248241c6968808d40c (patch)
tree75ec8957316013c6c311c7ffc9f35ee7ddcb5783 /Src
parentc1bef473646c5f9c44f53aab4c9f9a0ee33a8454 (diff)
downloadzsh-06b04ca1b2d7dcbc77787a248241c6968808d40c.tar.gz
zsh-06b04ca1b2d7dcbc77787a248241c6968808d40c.tar.xz
zsh-06b04ca1b2d7dcbc77787a248241c6968808d40c.zip
18435: unsetting readonly returned status 0
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c6
-rw-r--r--Src/params.c10
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 *