#define _GNU_SOURCE //#define __BSD_VISIBLE #include #include #include #include #include #include #define LIBCPATH "/lib64/libc.so.6" int (*next_open64)(const char *pathname, int flags, mode_t mode) = NULL; int main(void) { char *msg; int fd; next_open64=dlvsym(RTLD_NEXT, "open64","GLIBC_2.2.5"); fprintf(stderr,"dlvsym(open64): %p\n",*(next_open64)); if ( (msg = dlerror()) != NULL) fprintf (stderr, "dlvsym(%s): %s\n", "open64", msg); fd = next_open64("/etc/inittab", O_RDONLY, 0); close(fd); next_open64=dlsym(RTLD_NEXT, "open64"); if ( (msg = dlerror()) != NULL) fprintf (stderr, "dlsym(%s): %s\n", "open64", msg); fprintf(stderr,"dlsym(open64): %p\n",*(next_open64)); fd = next_open64("/etc/inittab", O_RDONLY, 0); return 0; }