aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-deps.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /elf/dl-deps.c
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'elf/dl-deps.c')
-rw-r--r--elf/dl-deps.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index a1c16d7310..c35cc977fa 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
/* Load the dependencies of a mapped object.
- Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -92,7 +92,7 @@ struct list
{
int done; /* Nonzero if this map was processed. */
struct link_map *map; /* The data. */
- struct list *next; /* Elements for normal list. */
+ struct list *next; /* Elements for normal list. */
};
@@ -101,9 +101,9 @@ struct list
({ \
const char *__str = (str); \
const char *__result = __str; \
- size_t __cnt = DL_DST_COUNT(__str, 0); \
+ size_t __dst_cnt = DL_DST_COUNT (__str, 0); \
\
- if (__cnt != 0) \
+ if (__dst_cnt != 0) \
{ \
char *__newp; \
\
@@ -113,9 +113,9 @@ struct list
DST not allowed in SUID/SGID programs")); \
\
__newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str), \
- __cnt)); \
+ __dst_cnt)); \
\
- __result = _dl_dst_substitute (l, __str, __newp, 0); \
+ __result = _dl_dst_substitute (l, __str, __newp, 0); \
\
if (*__result == '\0') \
{ \
@@ -235,16 +235,23 @@ _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);
+ objname = strdupa (objname);
+ if (malloced)
+ free ((char *) errstring);
+ errstring = new_errstring;
+
if (err)
errno_reason = err;
else
@@ -288,8 +295,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 +306,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 != INTUSE(_dl_out_of_memory))
+ if (malloced)
free ((char *) errstring);
/* Simply ignore this error and continue the work. */
@@ -316,8 +322,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 +332,17 @@ _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);
+ objname = strdupa (objname);
+ if (malloced)
+ free ((char *) errstring);
+ errstring = new_errstring;
+
if (err)
errno_reason = err;
else
@@ -566,8 +577,6 @@ Filters not supported with LD_TRACE_PRELINKING"));
{
/* A direct or transitive dependency is also on the list
of relocation dependencies. Remove the latter. */
- --map->l_reldeps[i]->l_opencount;
-
for (j = i + 1; j < map->l_reldepsact; ++j)
map->l_reldeps[j - 1] = map->l_reldeps[j];