diff options
author | jkh <jkh@FreeBSD.org> | 1997-06-11 08:41:10 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-06-11 08:41:10 +0000 |
commit | a0c781a8d7594a444c97cf2c8723cfe0aeca0074 (patch) | |
tree | 5273673eaf48d6bc752aeac28f9543ffe1ffb478 /usr.sbin/sysinstall/variable.c | |
parent | 5cfc21982c7428b1a96901cd5f74a59832f8bb94 (diff) | |
download | FreeBSD-src-a0c781a8d7594a444c97cf2c8723cfe0aeca0074.zip FreeBSD-src-a0c781a8d7594a444c97cf2c8723cfe0aeca0074.tar.gz |
YAMF22 - Bugs Of Evil in variable handling and rc.conf editing.
PR#: 3218 [partial]
Diffstat (limited to 'usr.sbin/sysinstall/variable.c')
-rw-r--r-- | usr.sbin/sysinstall/variable.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index 4bd2e78..0c579d6 100644 --- a/usr.sbin/sysinstall/variable.c +++ b/usr.sbin/sysinstall/variable.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: variable.c,v 1.17 1997/02/22 14:12:38 peter Exp $ + * $Id: variable.c,v 1.11.2.5 1997/06/11 08:39:27 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -111,16 +111,15 @@ variable_unset(char *var) Variable *vp; char name[512], *cp; - unsetenv(var); - if ((cp = index(var, '=')) != NULL) { - sstrncpy(name, cp, cp - var); - var = string_skipwhite(string_prune(name)); - } - + if ((cp = index(var, '=')) != NULL) + sstrncpy(name, var, cp - var); + else + SAFE_STRCPY(name, var); + unsetenv(name); /* Now search to see if it's in our list, if we have one.. */ if (!VarHead) return; - else if (!VarHead->next && !strcmp(VarHead->name, var)) { + else if (!VarHead->next && !strcmp(VarHead->name, name)) { safe_free(VarHead->name); safe_free(VarHead->value); free(VarHead); @@ -128,12 +127,12 @@ variable_unset(char *var) } else { for (vp = VarHead; vp; vp = vp->next) { - if (!strcmp(vp->name, var)) { + if (!strcmp(vp->name, name)) { Variable *save = vp->next; + safe_free(vp->name); + safe_free(vp->value); *vp = *save; - safe_free(save->name); - safe_free(save->value); safe_free(save); break; } |