diff options
author | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
commit | 3028e3f8aba938dfd0bf9fda987b8a72140b8027 (patch) | |
tree | b2f038222ff8a70f687652441df00d2b564c8abe /lib/csu | |
parent | 952a6d5a7cd3d3f9007acfa06805262fc04a105f (diff) | |
parent | 1d08d5f677c1dfa810e381073590adbae19cc69f (diff) | |
download | FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.zip FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.tar.gz |
Sync with HEAD.
Diffstat (limited to 'lib/csu')
-rw-r--r-- | lib/csu/amd64/crt1.c | 4 | ||||
-rw-r--r-- | lib/csu/arm/crt1.c | 5 | ||||
-rw-r--r-- | lib/csu/common/ignore_init.c | 14 | ||||
-rw-r--r-- | lib/csu/i386-elf/crt1_c.c | 5 | ||||
-rw-r--r-- | lib/csu/mips/crt1.c | 4 | ||||
-rw-r--r-- | lib/csu/powerpc/crt1.c | 4 | ||||
-rw-r--r-- | lib/csu/powerpc64/crt1.c | 5 | ||||
-rw-r--r-- | lib/csu/sparc64/crt1.c | 4 |
8 files changed, 16 insertions, 29 deletions
diff --git a/lib/csu/amd64/crt1.c b/lib/csu/amd64/crt1.c index f33aad6..3740e73 100644 --- a/lib/csu/amd64/crt1.c +++ b/lib/csu/amd64/crt1.c @@ -61,9 +61,7 @@ _start(char **ap, void (*cleanup)(void)) argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); diff --git a/lib/csu/arm/crt1.c b/lib/csu/arm/crt1.c index 127c28d..e3529b8 100644 --- a/lib/csu/arm/crt1.c +++ b/lib/csu/arm/crt1.c @@ -98,10 +98,7 @@ __start(int argc, char **argv, char **env, struct ps_strings *ps_strings, const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void)) { - environ = env; - - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; diff --git a/lib/csu/common/ignore_init.c b/lib/csu/common/ignore_init.c index e3d2441..89b3734 100644 --- a/lib/csu/common/ignore_init.c +++ b/lib/csu/common/ignore_init.c @@ -87,14 +87,18 @@ handle_static_init(int argc, char **argv, char **env) } static inline void -handle_progname(const char *v) +handle_argv(int argc, char *argv[], char **env) { const char *s; - __progname = v; - for (s = __progname; *s != '\0'; s++) { - if (*s == '/') - __progname = s + 1; + if (environ == NULL) + environ = env; + if (argc > 0 && argv[0] != NULL) { + __progname = argv[0]; + for (s = __progname; *s != '\0'; s++) { + if (*s == '/') + __progname = s + 1; + } } } diff --git a/lib/csu/i386-elf/crt1_c.c b/lib/csu/i386-elf/crt1_c.c index 3249069..65de04c 100644 --- a/lib/csu/i386-elf/crt1_c.c +++ b/lib/csu/i386-elf/crt1_c.c @@ -61,10 +61,7 @@ _start1(fptr cleanup, int argc, char *argv[]) char **env; env = argv + argc + 1; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); - + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else diff --git a/lib/csu/mips/crt1.c b/lib/csu/mips/crt1.c index 1968f06..95348b7 100644 --- a/lib/csu/mips/crt1.c +++ b/lib/csu/mips/crt1.c @@ -71,9 +71,7 @@ __start(char **ap, argc = * (long *) ap; argv = ap + 1; env = ap + 2 + argc; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); diff --git a/lib/csu/powerpc/crt1.c b/lib/csu/powerpc/crt1.c index c3be90d..d1a3ea0 100644 --- a/lib/csu/powerpc/crt1.c +++ b/lib/csu/powerpc/crt1.c @@ -81,10 +81,8 @@ _start(int argc, char **argv, char **env, struct ps_strings *ps_strings) { - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; diff --git a/lib/csu/powerpc64/crt1.c b/lib/csu/powerpc64/crt1.c index a7c3581..35c5a6e 100644 --- a/lib/csu/powerpc64/crt1.c +++ b/lib/csu/powerpc64/crt1.c @@ -81,10 +81,7 @@ _start(int argc, char **argv, char **env, struct ps_strings *ps_strings) { - environ = env; - - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; diff --git a/lib/csu/sparc64/crt1.c b/lib/csu/sparc64/crt1.c index 3b3ecc2..e11ae39 100644 --- a/lib/csu/sparc64/crt1.c +++ b/lib/csu/sparc64/crt1.c @@ -85,9 +85,7 @@ _start(char **ap, void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused, argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); |