diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2005-09-15 13:28:32 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2005-09-15 13:28:32 +0000 |
commit | aed6aa968462953d75beb0613b2b1a81b0eef4c4 (patch) | |
tree | b987187b9a9746658329a66057d6aa1d78ffe275 /regress/libexec/ld.so/dlsym/test1/libaa/aa.c | |
parent | 243432fb31fbfb39243f355e86a3ab5787ecce18 (diff) |
- close dlopen'ed libs for code correctness
- less verbose on success
- add a symbol for prog2 test
- fix comment
some feedback drahn@
Diffstat (limited to 'regress/libexec/ld.so/dlsym/test1/libaa/aa.c')
-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); } |