about summary refs log tree commit diff
path: root/sysdeps/generic/setenv.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-19 20:05:08 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-19 20:05:08 +0000
commit7195db12adc439aa7e4b1f494b144031dd50e30a (patch)
treeff46404749aca5fc8f1b78bc17a4b1a94521526d /sysdeps/generic/setenv.c
parent70aea399c8b3661f238b947c3f151866d3260c24 (diff)
downloadglibc-7195db12adc439aa7e4b1f494b144031dd50e30a.tar.gz
glibc-7195db12adc439aa7e4b1f494b144031dd50e30a.tar.xz
glibc-7195db12adc439aa7e4b1f494b144031dd50e30a.zip
Update.
1999-08-19  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/setenv.c: Update(__add_to_environ): Initialize
	ep after we have the lock.

	* sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h: New file.
	Patch by Richard Henderson.
Diffstat (limited to 'sysdeps/generic/setenv.c')
-rw-r--r--sysdeps/generic/setenv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index 387152dcad..29fc60c3fb 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -113,13 +113,17 @@ __add_to_environ (name, value, combined, replace)
      const char *combined;
      int replace;
 {
-  register char **ep = __environ;
+  register char **ep;
   register size_t size;
   const size_t namelen = strlen (name);
   const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
 
   LOCK;
 
+  /* We have to get the pointer now that we have the lock and not earlier
+     since another thread might have created a new environment.  */
+  ep = __environ;
+
   size = 0;
   if (ep != NULL)
     {