about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-03-15 17:06:21 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-03-15 17:06:21 -0700
commitcb219290492995bb52fba8c21f9f20afe5604721 (patch)
tree1b72cb9d373857a1faa754e03a3ea82ad6fae8f4
parenta3905fd9de77ffce9d2b6042b512b1816d90a3d2 (diff)
downloadglibc-cb219290492995bb52fba8c21f9f20afe5604721.tar.gz
glibc-cb219290492995bb52fba8c21f9f20afe5604721.tar.xz
glibc-cb219290492995bb52fba8c21f9f20afe5604721.zip
* stdlib/setenv.c (__add_to_environ): Revert previous change.
-rw-r--r--ChangeLog4
-rw-r--r--stdlib/setenv.c10
2 files changed, 5 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b3426b220..c856f796e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* stdlib/setenv.c (__add_to_environ): Revert previous change.
+
 2015-03-14  Andreas Schwab  <schwab@linux-m68k.org>
 
 	[BZ #18128]
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 05342367b1..b60c4f0151 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -114,16 +114,8 @@ __add_to_environ (name, value, combined, replace)
 {
   char **ep;
   size_t size;
-
-  /* Compute lengths before locking, so that the critical section is
-     less of a performance bottleneck.  VALLEN is needed only if
-     COMBINED is non-null.  Also, testing COMBINED instead of VALUE
-     causes setenv (..., NULL, ...) to dump core now instead of
-     corrupting memory later.  */
   const size_t namelen = strlen (name);
-  size_t vallen;
-  if (combined != NULL)
-    vallen = strlen (value) + 1;
+  const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
 
   LOCK;