aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 8656c0219..783204933 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12001,8 +12001,9 @@ setvar(const char *name, const char *val, int flags)
}
INTOFF;
p = mempcpy(nameeq = ckmalloc(namelen + vallen + 2), name, namelen);
- *p++ = '=';
- if (vallen) {
+ *p++ = '\0';
+ if (val) {
+ p[-1] = '=';
p = mempcpy(p, val, vallen);
}
*p = '\0';