diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-09-03 13:54:24 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-09-03 13:54:24 +0000 |
commit | ab7101aae5f2f063c2070986eab3aff47b463714 (patch) | |
tree | d71b854dbc91f56a2316b8c90a650f2dd0111bee /bin | |
parent | 9b1b4b69594eca4a25f1bc9966145e25cfe025cf (diff) |
Unsetting a non-existent variable is not an error. See
http://www.opengroup.org/onlinepubs/009695399/utilities/unset.html
report from Arkadiusz Miskiewicz; fixed based on
http://cvs.pld-linux.org diff; ok millert@ fgsch@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/c_sh.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c index 716dc7c70af..901e206fd2b 100644 --- a/bin/ksh/c_sh.c +++ b/bin/ksh/c_sh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_sh.c,v 1.36 2007/08/02 10:50:25 fgsch Exp $ */ +/* $OpenBSD: c_sh.c,v 1.37 2007/09/03 13:54:23 otto Exp $ */ /* * built-in Bourne commands @@ -648,7 +648,6 @@ c_unset(char **wp) { char *id; int optc, unset_var = 1; - int ret = 0; while ((optc = ksh_getopt(wp, &builtin_opt, "fv")) != -1) switch (optc) { @@ -666,18 +665,15 @@ c_unset(char **wp) 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; + return 0; } static void |