diff options
author | 2007-09-03 13:54:23 +0000 | |
---|---|---|
committer | 2007-09-03 13:54:23 +0000 | |
commit | 43f044487cecbf77ec8090b303fc95dd3a8d2677 (patch) | |
tree | 1b03033f09c79ba77cbe187f6e99e480e6c16d0e | |
parent | - break "Defaults env_keep" into several lines so it is more readable (diff) | |
download | wireguard-openbsd-43f044487cecbf77ec8090b303fc95dd3a8d2677.tar.xz wireguard-openbsd-43f044487cecbf77ec8090b303fc95dd3a8d2677.zip |
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@
-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 |