diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-03-13 17:02:23 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-03-13 17:02:23 +0000 |
commit | 14c44e2ec42a3c973e268add83a11e3e5fb0b80c (patch) | |
tree | 9b5d83d08dc977b0e6c97b7e977b591ef7bd47f3 /elf | |
parent | a7b591dc310c675cb325db9850f10c2e2fe1aba7 (diff) | |
download | glibc-14c44e2ec42a3c973e268add83a11e3e5fb0b80c.zip glibc-14c44e2ec42a3c973e268add83a11e3e5fb0b80c.tar.gz glibc-14c44e2ec42a3c973e268add83a11e3e5fb0b80c.tar.bz2 |
Update.
1998-03-13 16:55 Ulrich Drepper <drepper@cygnus.com>
* string/tester.c (test_strpbrk): Add more strpbrk tests.
(test_strsep): Likewise. Correct horrible bugs.
* string/bits/string2.h (strcspn): Optimize also reject string of
length 2 and 3.
(strspn): Likewise.
(strpbrk): Likewise.
(strsep): Likewise. Correct bug with successive separators and
separators at the end of the string.
* sysdeps/generic/strsep.c: Correct bug with successive separators
and separators at the end of the string.
1998-03-13 13:11 Tim Waugh <tim@cyberelk.demon.co.uk>
* posix/wordexp.c (parse_param): Positional parameters ($1, $2
etc) now handled, as well as $$ (pid).
* posix/Makefile (tests): Execute wordexp-test.sh for `make check'.
(distribute): Add wordexp-tst.sh.
* posix/wordexp-tst.sh: New file.
* posix/wordexp.c (parse_param): $# (or ${#}) expands to the
number of positional parameters. Renamed substitute_length to
seen_hash.
Don't free(env) is env is NULL.
1998-03-13 16:50 Ulrich Drepper <drepper@cygnus.com>
* libc.map: Add pthread_attr_init to GLIBC_2.1.
1998-03-13 15:01 Ulrich Drepper <drepper@cygnus.com>
* gmon/gmon.c: Allow GMON_OUT_PREFIX variable to specify filename
for output file replacing gmon.out.
Patch by Dean Gaudet <dgaudet@arctic.org>.
1998-03-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-misc.c (_dl_debug_message): Fix printing of pid. Clean
up namespace. Optimize finding end of line.
1998-03-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/rtld.c (process_envvars): Ignore LD_DEBUG_OUTPUT if running
securely. Optimized.
(process_dl_debug): Add ':' to list of separators. Optimized.
1998-03-13 10:25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-misc.c | 17 | ||||
-rw-r--r-- | elf/rtld.c | 318 |
2 files changed, 158 insertions, 177 deletions
diff --git a/elf/dl-misc.c b/elf/dl-misc.c index d3b0f34..937aeac 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -110,7 +110,7 @@ _dl_debug_message (int new_line, const char *msg, ...) va_list ap; if (pid == 0) - pid = getpid (); + pid = __getpid (); va_start (ap, msg); do @@ -125,17 +125,22 @@ _dl_debug_message (int new_line, const char *msg, ...) PID now if needed. */ if (new_line) { - char buf[7] = "00000:\t"; + char buf[7]; + char *p; assert (pid >= 0 && pid < 100000); - _itoa_word (pid, &buf[5], 10, 0); + p = _itoa_word (pid, &buf[5], 10, 0); + while (p > buf) + *--p = '0'; + buf[5] = ':'; + buf[6] = '\t'; __libc_write (_dl_debug_fd, buf, 7); new_line = 0; } - endp = strchr (msg, '\n'); - if (endp == NULL) + endp = msg + strcspn (msg, "\n"); + if (*endp == '\0') { - __libc_write (_dl_debug_fd, msg, strlen (msg)); + __libc_write (_dl_debug_fd, msg, endp - msg); msg = va_arg (ap, const char *); } else @@ -925,36 +925,25 @@ static int any_debug; /* Process the string given as the parameter which explains which debugging options are enabled. */ static void -process_dl_debug (char *dl_debug) +process_dl_debug (const char *dl_debug) { + size_t len; +#define separators " ,:" do { -#define issep(Ch) ((Ch) == ' ' || (Ch) == ',') + len = 0; /* Skip separating white spaces and commas. */ - while (issep (*dl_debug)) - ++dl_debug; + dl_debug += strspn (dl_debug, separators); if (*dl_debug != '\0') { - if (strncmp (dl_debug, "files", 5) == 0 - && (issep (dl_debug[5]) || dl_debug[5] == '\0')) - { - _dl_debug_files = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 5; - } - else if (strncmp (dl_debug, "bindings", 8) == 0 - && (issep (dl_debug[8]) || dl_debug[8] == '\0')) - { - _dl_debug_bindings = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 8; - } - else if (strncmp (dl_debug, "help", 4) == 0 - && (issep (dl_debug[4]) || dl_debug[4] == '\0')) + len = strcspn (dl_debug, separators); + + switch (len) { - _dl_sysdep_message ("\ + case 4: + if (memcmp (dl_debug, "help", 4) == 0) + { + _dl_sysdep_message ("\ Valid options for the LD_DEBUG environment variable are:\n\ \n\ bindings display information about symbol binding\n\ @@ -968,58 +957,77 @@ Valid options for the LD_DEBUG environment variable are:\n\ To direct the debugging output into a file instead of standard output\n\ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n", NULL); - _exit (0); - } - else if (strncmp (dl_debug, "libs", 4) == 0 - && (issep (dl_debug[4]) || dl_debug[4] == '\0')) - { - _dl_debug_libs = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 4; - } - else if (strncmp (dl_debug, "reloc", 4) == 0 - && (issep (dl_debug[5]) || dl_debug[5] == '\0')) - { - _dl_debug_reloc = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 5; - } - else if (strncmp (dl_debug, "symbols", 7) == 0 - && (issep (dl_debug[7]) || dl_debug[7] == '\0')) - { - _dl_debug_symbols = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 7; - } - else if (strncmp (dl_debug, "versions", 8) == 0 - && (issep (dl_debug[8]) || dl_debug[8] == '\0')) - { - _dl_debug_versions = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 8; - } - else - { - /* Display a warning and skip everything until next - separator. */ - char *startp = dl_debug; + _exit (0); + } - do - ++dl_debug; - while (*dl_debug != '\0' && !issep (*dl_debug)); + if (memcmp (dl_debug, "libs", 4) == 0) + { + _dl_debug_libs = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; + + case 5: + if (memcmp (dl_debug, "reloc", 5) == 0) + { + _dl_debug_reloc = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + + if (memcmp (dl_debug, "files", 5) == 0) + { + _dl_debug_files = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; - startp = strndupa (startp, dl_debug - startp); - _dl_sysdep_error ("warning: debug option `", startp, - "' unknown; try LD_DEBUG=help\n", NULL); + case 7: + if (memcmp (dl_debug, "symbols", 7) == 0) + { + _dl_debug_symbols = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; + case 8: + if (memcmp (dl_debug, "bindings", 8) == 0) + { + _dl_debug_bindings = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + + if (memcmp (dl_debug, "versions", 8) == 0) + { + _dl_debug_versions = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; + + default: + break; } + + { + /* Display a warning and skip everything until next separator. */ + char *startp = strndupa (dl_debug, len); + _dl_sysdep_error ("warning: debug option `", startp, + "' unknown; try LD_DEBUG=help\n", NULL); + } } } - while (*dl_debug != '\0'); + while (*(dl_debug += len) != '\0'); } /* Process all environments variables the dynamic linker must recognize. @@ -1039,126 +1047,94 @@ process_envvars (enum mode *modep, int *lazyp) while ((envline = _dl_next_ld_env_entry (&runp)) != NULL) { - int result; + size_t len = strcspn (envline, "=") - 3; - /* Do we bind early? */ - result = strncmp (&envline[3], "BIND_NOW=", 9); - if (result == 0) + switch (len) { - bind_now = 1; - continue; - } - if (result < 0) - continue; + case 4: + /* Warning level, verbose or not. */ + if (memcmp (&envline[3], "WARN", 4) == 0) + _dl_verbose = envline[8] != '\0'; + break; - /* Debugging of the dynamic linker? */ - result = strncmp (&envline[3], "DEBUG=", 6); - if (result == 0) - { - process_dl_debug (&envline[9]); - continue; - } - if (result < 0) - continue; + case 5: + /* Debugging of the dynamic linker? */ + if (memcmp (&envline[3], "DEBUG", 5) == 0) + process_dl_debug (&envline[9]); + break; - /* Where to place the profiling data file. */ - result = strncmp (&envline[3], "DEBUG_OUTPUT=", 13); - if (result == 0) - { - debug_output = &envline[16]; - continue; - } - if (result < 0) - continue; + case 7: + /* Print information about versions. */ + if (memcmp (&envline[3], "VERBOSE", 7) == 0) + { + version_info = envline[11] != '\0'; + break; + } - /* The library search path. */ - result = strncmp (&envline[3], "LIBRARY_PATH=", 13); - if (result == 0) - { - library_path = &envline[16]; - continue; - } - if (result < 0) - continue; + /* List of objects to be preloaded. */ + if (memcmp (&envline[3], "PRELOAD", 7) == 0) + { + preloadlist = &envline[11]; + break; + } - /* List of objects to be preloaded. */ - result = strncmp (&envline[3], "PRELOAD=", 8); - if (result == 0) - { - preloadlist = &envline[11]; - continue; - } - if (result < 0) - continue; + /* Which shared object shall be profiled. */ + if (memcmp (&envline[3], "PROFILE", 7) == 0) + { + _dl_profile = &envline[11]; + if (*_dl_profile == '\0') + _dl_profile = NULL; + } + break; - /* Which shared object shall be profiled. */ - result = strncmp (&envline[3], "PROFILE=", 8); - if (result == 0) - { - _dl_profile = &envline[11]; - if (*_dl_profile == '\0') - _dl_profile = NULL; - continue; - } - if (result < 0) - continue; + case 8: + /* Do we bind early? */ + if (memcmp (&envline[3], "BIND_NOW", 8) == 0) + bind_now = 1; + break; - /* Where to place the profiling data file. */ - result = strncmp (&envline[3], "PROFILE_OUTPUT=", 15); - if (result == 0) - { - _dl_profile_output = &envline[18]; - if (*_dl_profile_output == '\0') - _dl_profile_output = "/var/tmp"; - continue; - } - if (result < 0) - continue; + case 9: + /* Test whether we want to see the content of the auxiliary + array passed up from the kernel. */ + if (memcmp (&envline[3], "SHOW_AUXV", 9) == 0) + _dl_show_auxv (); + break; - /* Test whether we want to see the content of the auxiliary - array passed up from the kernel. */ - result = strncmp (&envline[3], "SHOW_AUXV=", 10); - if (result == 0) - { - _dl_show_auxv (); - continue; - } - if (result < 0) - continue; + case 12: + /* Where to place the profiling data file. */ + if (memcmp (&envline[3], "DEBUG_OUTPUT", 12) == 0) + { + debug_output = &envline[16]; + break; + } - /* The mode of the dynamic linker can be set. */ - result = strncmp (&envline[3], "TRACE_LOADED_OBJECTS=", 21); - if (result == 0) - { - mode = trace; - continue; - } - if (result < 0) - continue; + /* The library search path. */ + if (memcmp (&envline[3], "LIBRARY_PATH", 12) == 0) + library_path = &envline[16]; + break; - /* Print information about versions. */ - result = strncmp (&envline[3], "VERBOSE=", 8); - if (result == 0) - { - version_info = envline[11] != '\0'; - continue; - } - if (result < 0) - continue; + case 14: + /* Where to place the profiling data file. */ + if (memcmp (&envline[3], "PROFILE_OUTPUT", 14) == 0) + { + _dl_profile_output = &envline[18]; + if (*_dl_profile_output == '\0') + _dl_profile_output = "/var/tmp"; + } + break; - /* Warning level, verbose or not. */ - result = strncmp (&envline[3], "WARN=", 5); - if (result == 0) - { - _dl_verbose = envline[8] != '\0'; - continue; + case 20: + /* The mode of the dynamic linker can be set. */ + if (memcmp (&envline[3], "TRACE_LOADED_OBJECTS", 20) == 0) + mode = trace; + break; } } /* If we have to run the dynamic linker in debugging mode and the LD_DEBUG_OUTPUT environment variable is given, we write the debug messages to this file. */ - if (any_debug && debug_output != NULL) + if (any_debug && debug_output != NULL && !__libc_enable_secure) { _dl_debug_fd = __open (debug_output, O_WRONLY | O_APPEND | O_CREAT, 0666); |