This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
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
#define _GNU_SOURCE
#define _REENTRANT
#include <dlfcn.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
static int (*true_chown) (const char *, uid_t, gid_t);
extern int chown(const char *a, uid_t b, gid_t c) {
printf("Hello There\n");
return true_chown(a, b, c);
}
int main() {
#if 0
void *libc_handle = dlopen("libc.so.6", RTLD_LAZY);
#else
void *libc_handle = RTLD_NEXT;
#endif
char *dlerror_msg = NULL;
dlerror();
true_chown = dlsym(libc_handle, "chown");
if (NULL == true_chown) {
dlerror_msg = dlerror();
if (NULL != dlerror_msg)
printf("%s\n", dlerror_msg);
else
printf("Error loading requested symbol!\n");
exit(1);
}
chown("blah", 0, 0);
return 0;
}
Attachment:
signature.asc
Description: This is a digitally signed message part
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |