rpm/rpm-5.4.5-fix-elf-interpreter-resolving-breaking-uclibc-deps.patch

59 lines
1.6 KiB
Diff
Raw Normal View History

2012-08-01 14:59:23 +04:00
--- rpm-5.4.5/lib/rpmds.c.uclibc~ 2012-03-01 15:13:53.758195733 +0100
+++ rpm-5.4.5/lib/rpmds.c 2012-03-01 15:15:13.648235553 +0100
@@ -3016,31 +3016,28 @@ foo:
data = NULL;
while ((data = elf_getdata (scn, data)) != NULL) {
int dynsize = (int)(shdr->sh_size / shdr->sh_entsize)-1;
+ for (cnt = dynsize; cnt >= 0; --cnt) {
+ dyn = gelf_getdyn (data, cnt, &dyn_mem);
+
+ if (dyn->d_tag == DT_RPATH || dyn->d_tag == DT_RUNPATH) {
+ rpath = elf_strptr (elf, shdr->sh_link, dyn->d_un.d_val);
+ break;
+ }
+ }
for (cnt = 0; cnt <= dynsize; ++cnt) {
dyn = gelf_getdyn (data, cnt, &dyn_mem);
/* if this an elf interpeter, the only thing we want is to find SONAME
* and return it
*/
- if (phdr) {
- if (dyn->d_tag != DT_SONAME)
- continue;
+ if (phdr && dyn->d_tag == DT_SONAME) {
interp_name = strdup(elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val));
goto end;
}
- if (rpath == NULL) {
- if (dyn->d_tag == DT_RPATH)
- rpath = elf_strptr (elf, shdr->sh_link, dyn->d_un.d_val);
- else if (cnt == dynsize)
- rpath = "";
- if (rpath != NULL)
- cnt = -1;
- continue;
- }
- else if (rpath && dyn->d_tag == DT_NEEDED) {
+ if (dyn->d_tag == DT_NEEDED) {
char *tmp, *tmp2;
- char buf[1024];
- char path[1024] = "";
+ char buf[MAXPATHLEN];
+ char path[MAXPATHLEN] = "";
libpath = elf_strptr (elf, shdr->sh_link, dyn->d_un.d_val);
@@ -3106,10 +3103,10 @@ foo:
*tmp = '\0';
}
libpath = buf;
+ break;
}
}
}
- break;
}
}