about summary refs log tree commit diff
path: root/sysdeps/generic/setenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/setenv.c')
-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);
     }