diff options
-rw-r--r-- | regress/libexec/ld.so/dlsym/test1/libaa/aa.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/regress/libexec/ld.so/dlsym/test1/libaa/aa.c b/regress/libexec/ld.so/dlsym/test1/libaa/aa.c index e66ceda0ec6..40605596337 100644 --- a/regress/libexec/ld.so/dlsym/test1/libaa/aa.c +++ b/regress/libexec/ld.so/dlsym/test1/libaa/aa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aa.c,v 1.1 2005/09/14 15:59:37 kurt Exp $ */ +/* $OpenBSD: aa.c,v 1.2 2005/09/15 13:28:31 kurt Exp $ */ /* * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org> @@ -21,6 +21,8 @@ #include <stdio.h> #include "aa.h" +int aaSymbol; + void sigprocmask() { } @@ -29,25 +31,29 @@ sigprocmask() { * aaTest verifies dlsym works as expected with a simple case of duplicate * symbols. prog1, libaa and libc all have the sigprocmask symbol and are * linked with prog1 with libaa before libc. Depending on how dlsym is called - * the symbol for sigprocmask should come from prog1 libaa or libc. + * the symbol for sigprocmask should come from prog1, libaa or libc. */ int aaTest() { int ret = 0; void *value; - void *libaa_sigprocmask = dlsym(dlopen("libaa.so", RTLD_LAZY), "sigprocmask"); - void *libc_sigprocmask = dlsym(dlopen("libc.so", RTLD_LAZY), "sigprocmask"); + void *libaa_handle = dlopen("libaa.so", RTLD_LAZY); + void *libc_handle = dlopen("libc.so", RTLD_LAZY); + void *libaa_sigprocmask = dlsym(libaa_handle, "sigprocmask"); + void *libc_sigprocmask = dlsym(libc_handle, "sigprocmask"); - printf("sigprocmask == %p\n", &sigprocmask); - printf("libaa_sigprocmask == %p\n", libaa_sigprocmask); - printf("libc_sigprocmask == %p\n", libc_sigprocmask); + dlclose(libaa_handle); + dlclose(libc_handle); /* basic sanity check */ if (libaa_sigprocmask == &sigprocmask || libc_sigprocmask == &sigprocmask || libc_sigprocmask == libaa_sigprocmask || libaa_sigprocmask == NULL || libc_sigprocmask == NULL) { printf("dlsym(handle, ...)\n FAILED\n"); + printf("sigprocmask == %p\n", &sigprocmask); + printf("libaa_sigprocmask == %p\n", libaa_sigprocmask); + printf("libc_sigprocmask == %p\n", libc_sigprocmask); return (-1); } |