diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-06-12 16:29:51 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-06-12 16:29:51 +0000 |
commit | 74780cf659d1e5cd91e82b6e5314dcfc7bba033b (patch) | |
tree | d71a5f1c94a7b7ac1a117760f2f3bd45ab1eea1d /elf/dl-deps.c | |
parent | 6dffebd8b4ef0e3310ac97cade0d5dc33c49dadc (diff) | |
download | glibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.zip glibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.tar.gz glibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.tar.bz2 |
* elf/dl-error.c (_dl_signal_error): Store information about use of
real malloc in the catch object.
(_dl_catch_error): Forward information about malloc use to caller
in new parameter.
(_dl_out_of_memory): Make static.
* elf/dl-deps.c: Adjust callers of _dl_catch_error.
* elf/dl-libc.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/rtld.c: Likewise.
Add new --audit option.
* sysdeps/generic/ldsodefs.h: Remove _dl_out_of_memory declaration.
(rtld_global_ro._dl_signal_error): Add new parameter.
* include/dlfcn.h (_dl_catch_error): Add new parameter.
* dlfcn/dlfcn.c (_dlerror_run): Pass additional parameter to
_dl_catch_error. Only free if the returned newly value says so.
Diffstat (limited to 'elf/dl-deps.c')
-rw-r--r-- | elf/dl-deps.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/elf/dl-deps.c b/elf/dl-deps.c index 50d7a0e..a73e21d 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -235,16 +235,22 @@ _dl_map_object_deps (struct link_map *map, { /* Map in the needed object. */ struct link_map *dep; - int err; /* Recognize DSTs. */ name = expand_dst (l, strtab + d->d_un.d_val, 0); /* Store the tag in the argument structure. */ args.name = name; - err = _dl_catch_error (&objname, &errstring, openaux, &args); + bool malloced; + int err = _dl_catch_error (&objname, &errstring, &malloced, + openaux, &args); if (__builtin_expect (errstring != NULL, 0)) { + char *new_errstring = strdupa (errstring); + if (malloced) + free ((char *) errstring); + errstring = new_errstring; + if (err) errno_reason = err; else @@ -288,8 +294,6 @@ _dl_map_object_deps (struct link_map *map, if (d->d_tag == DT_AUXILIARY) { - int err; - /* Say that we are about to load an auxiliary library. */ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)) @@ -301,13 +305,14 @@ _dl_map_object_deps (struct link_map *map, /* We must be prepared that the addressed shared object is not available. */ - err = _dl_catch_error (&objname, &errstring, openaux, - &args); + bool malloced; + (void) _dl_catch_error (&objname, &errstring, &malloced, + openaux, &args); if (__builtin_expect (errstring != NULL, 0)) { /* We are not interested in the error message. */ assert (errstring != NULL); - if (errstring != _dl_out_of_memory) + if (malloced) free ((char *) errstring); /* Simply ignore this error and continue the work. */ @@ -316,8 +321,6 @@ _dl_map_object_deps (struct link_map *map, } else { - int err; - /* Say that we are about to load an auxiliary library. */ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)) @@ -328,10 +331,16 @@ _dl_map_object_deps (struct link_map *map, ? l->l_name : rtld_progname); /* For filter objects the dependency must be available. */ - err = _dl_catch_error (&objname, &errstring, openaux, - &args); + bool malloced; + int err = _dl_catch_error (&objname, &errstring, &malloced, + openaux, &args); if (__builtin_expect (errstring != NULL, 0)) { + char *new_errstring = strdupa (errstring); + if (malloced) + free ((char *) errstring); + errstring = new_errstring; + if (err) errno_reason = err; else |