summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/var.c3
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';