[PATCH] _dl_{,v}sym fix
Jakub Jelinek
jakub@redhat.com
Tue May 9 03:23:00 GMT 2000
Hi!
Following patch fixes the following testcase:
===
#include <dlfcn.h>
#include <stdlib.h>
int main()
{
void *sym;
void *handle = dlopen (NULL, RTLD_LAZY);
if (!handle)
{
printf ("%s\n", dlerror());
return 1;
}
sym = dlsym (handle, "main");
if (!sym)
{
printf ("%s\n", dlerror());
return 1;
}
dlclose (handle);
return 0;
}
===
It matches the common usage of _dl_lookup* functions where the symbol is
checked for non-zero, not the return value because it may be 0.
2000-05-09 Jakub Jelinek <jakub@redhat.com>
* elf/dl-sym.c (_dl_sym): Test ref not result for non-zero.
(_dl_vsym): Likewise.
Reported by Owen Taylor <otaylor@redhat.com>.
--- libc/elf/dl-sym.c.jj Mon May 8 21:28:14 2000
+++ libc/elf/dl-sym.c Tue May 9 12:08:23 2000
@@ -74,7 +74,7 @@ RTLD_NEXT used in code not dynamically l
}
}
- if (result)
+ if (ref)
return DL_SYMBOL_ADDRESS (result, ref);
return NULL;
@@ -130,7 +130,7 @@ RTLD_NEXT used in code not dynamically l
map->l_local_scope, &vers, 0);
}
- if (result)
+ if (ref)
return DL_SYMBOL_ADDRESS (result, ref);
return NULL;
}
Jakub
More information about the Libc-hacker
mailing list