about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2014-02-10 14:22:31 +0100
committerOndřej Bílka <neleai@seznam.cz>2014-02-10 14:22:31 +0100
commit1448f3244714a9dabb5240ec18b094f100887d5c (patch)
treec1dac2912517bfced0054353522ad832d1ddddeb /stdlib
parentf3d338c9f3e84dac5458d388efd785c4ef0df7ec (diff)
downloadglibc-1448f3244714a9dabb5240ec18b094f100887d5c.tar.gz
glibc-1448f3244714a9dabb5240ec18b094f100887d5c.tar.xz
glibc-1448f3244714a9dabb5240ec18b094f100887d5c.zip
Fix previous commit.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/setenv.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 3043498103..6b5f9be8d5 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -146,6 +146,11 @@ __add_to_environ (name, value, combined, replace)
 	  UNLOCK;
 	  return -1;
 	}
+
+      if (__environ != last_environ)
+	memcpy ((char *) new_environ, (char *) __environ,
+		size * sizeof (char *));
+
       new_environ[size] = NULL;
       new_environ[size + 1] = NULL;
       ep = new_environ + size;