dlsym() and RTLD_NEXT resolves wrong symbol

Martin Schlemmer azarah@nosferatu.za.org
Fri Feb 11 09:04:00 GMT 2005


Hi,

I have a test file attached that wraps chown() (Yes, its a rough
test case).  If I use dlsym(dlopen("libc.so.6", RTLD_LAZY), "chown")
to find the chown symbol, it works fine.  If I though use
dlsym(RTLD_NEXT, "chown"), it seems to find 'lchown'.

---
~/tmp $ strace -f ./test-RTLD_LAZY 2>&1 | grep chown
chown32("blah", 0, 0)                   = -1 ENOENT (No such file or directory)
~/tmp $ strace -f ./test-RTLD_NEXT 2>&1 | grep chown
lchown32("blah", 0, 0)                  = -1 ENOENT (No such file or directory)
~/tmp $
---

--- glibc info ---
~/tmp $ /lib/libc-2.3.4.so
GNU C Library stable release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.3.5
Compiled on a Linux 2.6.8 system on 2005-02-07.
Available extensions:
        GNU libio by Per Bothner
        crypt add-on version 2.1 by Michael Glad and others
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
---

Any ideas would be appreciated.


Thanks,

-- 
Martin Schlemmer


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-sandbox.c
Type: text/x-csrc
Size: 743 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20050211/2aca47d7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20050211/2aca47d7/attachment.sig>


More information about the Libc-alpha mailing list