]> sourceware.org Git - glibc.git/blobdiff - sysdeps/unix/sysv/linux/init-first.c
handle password file locking.
[glibc.git] / sysdeps / unix / sysv / linux / init-first.c
index feff028a2862ee97d452553ae834d50b7f373335..ae163bcd493aefbc49043ee6523fb4cb747abd8e 100644 (file)
@@ -36,21 +36,30 @@ weak_extern (_dl_starting_up)
    used in the process.  Safe assumption if initializer never runs.  */
 int __libc_multiple_libcs = 1;
 
+/* Remember the command line argument and enviroment contents for
+   later calls of initializers for dynamic libraries.  */
+int __libc_argc;
+char **__libc_argv;
+char **__libc_envp;
+
+
 static void
 init (void *data)
 {
   extern int __personality (int);
 
-  int argc = *(long *)data;
-  char **argv = (char **)data + 1;
-  char **envp = &argv[argc + 1];
-
-
   __libc_multiple_libcs = &_dl_starting_up && ! _dl_starting_up;
 
+
   /* We must not call `personality' twice.  */
   if (!__libc_multiple_libcs)
     {
+      /* The argument we got points to the values describing the
+        command line argument etc.  */
+      __libc_argc = *(int *)data;
+      __libc_argv = (char **)data + 1;
+      __libc_envp = &__libc_argv[__libc_argc + 1];
+
       /* The `personality' system call takes one argument that chooses
         the "personality", i.e. the set of system calls and such.  We
         must make this call first thing to disable emulation of some
@@ -61,9 +70,17 @@ init (void *data)
       /* Set the FPU control word to the proper default value.  */
       __setfpucw (__fpu_control);
     }
+  else
+    {
+      /* The argument we got points to the values describing the
+        command line argument etc.  */
+      __libc_argc = *((int *)data)++;
+      __libc_argv = *((char ***)data)++;
+      __libc_envp = *(char ***)data;
+    }
 
-  __environ = envp;
-  __libc_init (argc, argv, envp);
+  __environ = __libc_envp;
+  __libc_init (__libc_argc, __libc_argv, __libc_envp);
 
 #ifdef PIC
   __libc_global_ctors ();
This page took 0.029503 seconds and 5 git commands to generate.