diff options
author | herbert <herbert@gondor.apana.org.au> | 2005-03-25 20:23:55 +1100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2005-09-26 18:33:05 +1000 |
commit | 6d8a11f801b41b629d0ad3c71fc5298354ae99ef (patch) | |
tree | 753ae678750fe77c2a9aad9609291a361f38806b | |
parent | Add trailing equal sign in setvar for variables set to null. (diff) | |
download | dash-6d8a11f801b41b629d0ad3c71fc5298354ae99ef.tar.gz dash-6d8a11f801b41b629d0ad3c71fc5298354ae99ef.zip |
Eliminate first null termination in setvar.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/var.c | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 3ddfd80..1830be2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * Cleaned up src/Makefile.am. * Get rid of duplicate -g -O2 in CFLAGS. + * Eliminate first null termination in setvar. 2005-03-25 Gilles Chanteperdrix <gilles.chanteperdrix@laposte.net> diff --git a/src/var.c b/src/var.c index a7791eb..ea62327 100644 --- a/src/var.c +++ b/src/var.c @@ -231,9 +231,8 @@ setvar(const char *name, const char *val, int flags) } INTOFF; p = mempcpy(nameeq = ckmalloc(namelen + vallen + 2), name, namelen); - *p++ = '\0'; if (val) { - p[-1] = '='; + *p++ = '='; p = mempcpy(p, val, vallen); } *p = '\0'; |