about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/setenv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index 6d0c23114c..94dc7472ec 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -132,9 +132,9 @@ setenv (name, value, replace)
 	      return -1;
 	    }
 	  *ep = new;
+	  memcpy (*ep, name, namelen);
+	  (*ep)[namelen] = '=';
 	}
-      memcpy (*ep, name, namelen);
-      (*ep)[namelen] = '=';
       memcpy (&(*ep)[namelen + 1], value, vallen);
     }