diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-08-17 19:50:34 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-08-17 19:50:34 +0000 |
commit | 258f0380264acd8972bafabf463823514b6e13e8 (patch) | |
tree | af6920ce3d5626be2a33e61054fa64698489c168 | |
parent | 0870301b935fe013955c4194db18b474b4a85723 (diff) | |
download | uClibc-alpine-258f0380264acd8972bafabf463823514b6e13e8.tar.bz2 uClibc-alpine-258f0380264acd8972bafabf463823514b6e13e8.tar.xz |
Fix a stupid bug causing the ld-uClibc entry to be lost.
-rw-r--r-- | ldso/util/ldd.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/ldso/util/ldd.c b/ldso/util/ldd.c index 0cf3c798e..132457905 100644 --- a/ldso/util/ldd.c +++ b/ldso/util/ldd.c @@ -221,7 +221,7 @@ void locate_library_file(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *strtab, int static int add_library(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *strtab, int is_setuid, const char *s) { - struct library *cur, *prev, *newlib=lib_list; + struct library *cur, *newlib=lib_list; if (!s || !strlen(s)) return 1; @@ -254,9 +254,8 @@ static int add_library(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *strtab, int i if (!lib_list) { lib_list = newlib; } else { - for (cur = prev = lib_list; cur->next; prev=cur, cur=cur->next); /* nothing */ - cur = newlib; - prev->next = cur; + for (cur = lib_list; cur->next; cur=cur->next); /* nothing */ + cur->next = newlib; } return 0; } @@ -275,18 +274,17 @@ static void find_needed_libraries(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *st static void find_elf_interpreter(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *strtab, int is_setuid) { + static int been_there_done_that=0; Elf32_Phdr *phdr; + + if (been_there_done_that==1) + return; + been_there_done_that=1; phdr = elf_find_phdr_type(PT_INTERP, ehdr); if (phdr) { - struct library *cur, *prev, *newlib=lib_list; + struct library *cur, *newlib=lib_list; char *s = (char*)ehdr + phdr->p_offset; - for (cur = lib_list; cur; cur=cur->next) { - if(strcmp(cur->name, s)==0) { - /* Lib is already in the list */ - return; - } - } newlib = malloc(sizeof(struct library)); if (!newlib) return; @@ -300,9 +298,8 @@ static void find_elf_interpreter(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *str if (!lib_list) { lib_list = newlib; } else { - for (cur = prev = lib_list; cur->next; prev=cur, cur=cur->next); /* nothing */ - cur = newlib; - prev->next = cur; + for (cur = lib_list; cur->next; cur=cur->next); /* nothing */ + cur->next = newlib; } } } |