This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi! This patch adds a testcase whether _dl_argv is setup properly. 2000-11-15 Jakub Jelinek <jakub@redhat.com> * dlfcn/default.c (main): Add test for dladdr of main returning argv[0] in dli_fname field. --- libc/dlfcn/default.c.jj Sat Sep 16 11:05:17 2000 +++ libc/dlfcn/default.c Wed Nov 15 14:19:57 2000 @@ -1,5 +1,6 @@ #include <dlfcn.h> #include <stdio.h> +#include <string.h> extern int test_in_mod1 (void *); @@ -12,7 +13,22 @@ main (int argc, char *argv[]) int (*ifp) (void); void *p; int result = 0; - + Dl_info info; + + dladdr(main, &info); + if (info.dli_fname == NULL) + { + printf ("%s: dladdr returns NULL dli_fname\n", __FILE__); + result = 1; + } + else if (strcmp (info.dli_fname, argv[0])) + { + printf ("%s: dladdr returned '%s' as dli_fname\n", __FILE__, info.dli_fname); + result = 1; + } + else + printf ("%s: dladdr returned correct dli_fname\n", __FILE__); + /* Find function `main'. */ p = dlsym (RTLD_DEFAULT, "main"); if (p == NULL) Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |