summaryrefslogtreecommitdiffstats
path: root/system/pdksh/patches/103_PLD-pdksh-unset.patch
blob: 9f17b9409b6da7f19dbf3b15f38b25e649439051 (plain)
unset on unknown variable is not an error, 
see http://www.opengroup.org/onlinepubs/009695399/utilities/unset.html
(from PLD)

Index: pdksh-5.2.14/c_sh.c
===================================================================
--- pdksh-5.2.14.orig/c_sh.c	2008-04-15 20:51:18.000000000 +0200
+++ pdksh-5.2.14/c_sh.c	2008-04-15 20:56:22.000000000 +0200
@@ -688,16 +688,13 @@
 		if (unset_var) {	/* unset variable */
 			struct tbl *vp = global(id);
 
-			if (!(vp->flag & ISSET))
-			    ret = 1;
 			if ((vp->flag&RDONLY)) {
 				bi_errorf("%s is read only", vp->name);
 				return 1;
 			}
 			unset(vp, strchr(id, '[') ? 1 : 0);
 		} else {		/* unset function */
-			if (define(id, (struct op *) NULL))
-				ret = 1;
+			define(id, (struct op *) NULL);
 		}
 	return ret;
 }