From dcf0671d905200c449f92ead6cf43c184637a0d5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 26 Aug 1996 10:28:45 +0000 Subject: handle password file locking. --- sysdeps/unix/sysv/linux/init-first.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c index feff028..ae163bc 100644 --- a/sysdeps/unix/sysv/linux/init-first.c +++ b/sysdeps/unix/sysv/linux/init-first.c @@ -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 (); -- cgit v1.1