about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-03-09 17:13:59 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-03-09 17:13:59 +0000
commit7208c4024ea188e904b2aa28a79c6959e9b04a6e (patch)
tree8a59fe279fe8619882e6b7c811ea916b0cffa2be /Src
parent0c3de591d3c90f555645dbde4aea4c800e18332d (diff)
downloadzsh-7208c4024ea188e904b2aa28a79c6959e9b04a6e.tar.gz
zsh-7208c4024ea188e904b2aa28a79c6959e9b04a6e.tar.xz
zsh-7208c4024ea188e904b2aa28a79c6959e9b04a6e.zip
20955: "unset foo" should return status 0 if foo was not set
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 6fcfabfda..724a6baec 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2726,8 +2726,12 @@ bin_unset(char *name, char **argv, Options ops, int func)
 	pm = (Param) (paramtab == realparamtab ?
 		      gethashnode2(paramtab, s) :
 		      paramtab->getnode(paramtab, s));
+	/*
+	 * Unsetting an unset variable is not an error.
+	 * This appears to be reasonably standard behaviour.
+	 */
 	if (!pm)
-	    returnval = 1;
+	    continue;
 	else if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
 	    zerrnam(name, "%s: restricted", pm->nam, 0);
 	    returnval = 1;