summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2001-08-20 21:44:01 +0000
committerMark Kettenis <kettenis@gnu.org>2001-08-20 21:44:01 +0000
commit16195d2026aac75c590699400b602581e977d0f6 (patch)
tree88516dd937b65d9511ee7bb8e590fa756da226ee
parent29f0517d466970022c64994257c6cdfc70ccb604 (diff)
downloadglibc-16195d2026aac75c590699400b602581e977d0f6.tar.gz
glibc-16195d2026aac75c590699400b602581e977d0f6.tar.xz
glibc-16195d2026aac75c590699400b602581e977d0f6.zip
* sysdeps/mach/hurd/i386/init-first.c (init): Initialize __environ before calling the cthreads initialization code.
2001-08-18  Mark Kettenis  <kettenis@gnu.org>

	* sysdeps/mach/hurd/i386/init-first.c (init): Initialize __environ
	before calling the cthreads initialization code.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c14
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a0e538d03..bf801e215f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-18  Mark Kettenis  <kettenis@gnu.org>
+
+	* sysdeps/mach/hurd/i386/init-first.c (init): Initialize __environ
+	before calling the cthreads initialization code.
+
 2001-08-20  Ulrich Drepper  <drepper@redhat.com>
 
 	* argp/argp-help.c: Fix two problems introduced in last change.
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index 15c9deab55..a50e41892a 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -132,12 +132,20 @@ init (int *data)
   struct hurd_startup_data *d;
   unsigned long int threadvars[_HURD_THREADVAR_MAX];
 
-  /* Provide temporary storage for thread-specific variables on the startup
-     stack so the cthreads initialization code can use them for malloc et al,
-  or so we can use malloc below for the real threadvars array.  */
+  /* Provide temporary storage for thread-specific variables on the
+     startup stack so the cthreads initialization code can use them
+     for malloc et al, or so we can use malloc below for the real
+     threadvars array.  */
   memset (threadvars, 0, sizeof threadvars);
   __hurd_threadvar_stack_offset = (unsigned long int) threadvars;
 
+  /* Since the cthreads initialization code uses malloc, and the
+     malloc initialization code needs to get at the environment, make
+     sure we can find it.  We'll need to do this again later on since
+     switching stacks changes the location where the environment is
+     stored.  */
+  __environ = envp;
+
   while (*envp)
     ++envp;
   d = (void *) ++envp;