diff options
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-error.c | 1 | ||||
-rw-r--r-- | elf/dl-load.c | 6 | ||||
-rw-r--r-- | elf/dl-reloc.c | 6 | ||||
-rw-r--r-- | elf/rtld.c | 22 |
4 files changed, 28 insertions, 7 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c index b5af2e323f..a5c861190f 100644 --- a/elf/dl-error.c +++ b/elf/dl-error.c @@ -46,6 +46,7 @@ _dl_catch_error (const char **errstring, if (errcode == 0) { (*operate) (); + *errstring = *objname = NULL; return 0; } diff --git a/elf/dl-load.c b/elf/dl-load.c index bb1ad972d4..c48286f938 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -54,7 +54,7 @@ open_path (const char *name, size_t namelen, const char *dirpath, char **realname) { - char buf[strlen (dirpath) + 1 + namelen]; + char *buf; const char *p; int fd; @@ -65,6 +65,7 @@ open_path (const char *name, size_t namelen, return -1; } + buf = alloca (strlen (dirpath) + 1 + namelen); do { dirpath = p; @@ -166,7 +167,8 @@ _dl_map_object (struct link_map *loader, const char *name, fd = -1; if (loader && loader->l_info[DT_RPATH]) trypath ((const char *) (loader->l_addr + - loader->l_info[DT_RPATH]->d_un.d_ptr)); + loader->l_info[DT_STRTAB]->d_un.d_ptr + + loader->l_info[DT_RPATH]->d_un.d_val)); if (fd == -1 && ! _dl_secure) trypath (getenv ("LD_LIBRARY_PATH")); if (fd == -1) diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index a3590ff749..7cbed389b8 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -69,7 +69,8 @@ _dl_relocate_object (struct link_map *l, int lazy) real_next = l->l_next; if (l->l_info[DT_SYMBOLIC]) { - l->l_prev->l_next = real_next; + if (l->l_prev) + l->l_prev->l_next = real_next; l->l_next = _dl_loaded; scope = l; } @@ -88,7 +89,8 @@ _dl_relocate_object (struct link_map *l, int lazy) /* Restore list frobnication done above for DT_SYMBOLIC. */ l->l_next = real_next; - l->l_prev->l_next = l; + if (l->l_prev) + l->l_prev->l_next = l; } if (l->l_info[DT_JMPREL] && lazy) diff --git a/elf/rtld.c b/elf/rtld.c index c36409a995..7855c59052 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -144,8 +144,8 @@ command line to load and run an ELF executable file; this is like executing\n\ that file itself, but always uses this helper program from the file you\n\ specified, instead of the helper program file specified in the executable\n\ file you run. This is mostly of use for maintainers to test new versions\n\ -of this helper program; chances are you did not intend to run this program.\n" - ); +of this helper program; chances are you did not intend to run this program.\n", + NULL); rtld_command = 1; interpreter_name = _dl_argv[0]; @@ -289,9 +289,25 @@ __assert_fail (const char *assertion, _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ", file, ": ", _itoa (line, buf + sizeof buf - 1, 10, 0), ": ", function ?: "", function ? ": " : "", - "Assertion `", assertion, "' failed!\n"); + "Assertion `", assertion, "' failed!\n", + NULL); } weak_symbol (__assert_fail) +void +__assert_perror_fail (int errnum, + const char *file, unsigned int line, + const char *function) +{ + char buf[64]; + buf[sizeof buf - 1] = '\0'; + _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ", + file, ": ", _itoa (line, buf + sizeof buf - 1, 10, 0), + ": ", function ?: "", function ? ": " : "", + "Unexpected error: ", strerror (errnum), "\n", NULL); + +} +weak_symbol (__assert_perror_fail) + #endif |