1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
Index: eglibc-2.10/elf/rtld.c
===================================================================
--- eglibc-2.10.orig/elf/rtld.c 2010-04-16 12:56:28.000000000 +0300
+++ eglibc-2.10/elf/rtld.c 2010-04-16 12:56:31.000000000 +0300
@@ -922,6 +922,7 @@
if (*user_entry == (ElfW(Addr)) ENTRY_POINT)
{
+ const char *forced_argv0 = NULL;
/* Ho ho. We are not the program interpreter! We are the program
itself! This means someone ran ld.so as a command. Well, that
might be convenient to do sometimes. We support it by
@@ -986,6 +987,14 @@
_dl_argc -= 2;
INTUSE(_dl_argv) += 2;
}
+ else if (! strcmp (INTUSE(_dl_argv)[1], "--argv0") && _dl_argc > 2)
+ {
+ forced_argv0 = INTUSE(_dl_argv)[2];
+
+ _dl_skip_args += 2;
+ _dl_argc -= 2;
+ INTUSE(_dl_argv) += 2;
+ }
else
break;
@@ -1013,6 +1022,8 @@
variable LD_LIBRARY_PATH\n\
--inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
in LIST\n\
+ in LIST\n\
+ --argv0 STRING use STRING as argv[0]\n\
--audit LIST use objects named in LIST as auditors\n");
++_dl_skip_args;
@@ -1066,6 +1077,8 @@
HP_TIMING_DIFF (load_time, start, stop);
}
+ if (forced_argv0 != NULL) _dl_argv[0] = forced_argv0;
+
/* Now the map for the main executable is available. */
main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|