diff options
| author | Enji Cooper <ngie@FreeBSD.org> | 2017-01-15 09:35:49 +0000 |
|---|---|---|
| committer | Enji Cooper <ngie@FreeBSD.org> | 2017-01-15 09:35:49 +0000 |
| commit | 181439425f0bb490970e4e7022295f139d9988ad (patch) | |
| tree | f50851860df5c384bd23ea79e5af032c745fad3a /lib/libc/string | |
| parent | a567518138e0e2fa7177c60e241e8b8e4bb468d5 (diff) | |
Notes
Diffstat (limited to 'lib/libc/string')
| -rw-r--r-- | lib/libc/string/t_strlen.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/string/t_strlen.c b/lib/libc/string/t_strlen.c index 66158fd7113f..9899e6d5944c 100644 --- a/lib/libc/string/t_strlen.c +++ b/lib/libc/string/t_strlen.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_strlen.c,v 1.5 2011/07/14 07:33:20 jruoho Exp $ */ +/* $NetBSD: t_strlen.c,v 1.6 2017/01/14 20:49:24 christos Exp $ */ /* * Written by J.T. Conklin <jtc@acorntoolworks.com> @@ -40,6 +40,7 @@ ATF_TC_HEAD(strlen_basic, tc) ATF_TC_BODY(strlen_basic, tc) { + void *dl_handle; /* try to trick the compiler */ size_t (*strlen_fn)(const char *); @@ -107,7 +108,8 @@ ATF_TC_BODY(strlen_basic, tc) * During testing it is useful have the rest of the program * use a known good version! */ - strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen"); + dl_handle = dlopen(NULL, RTLD_LAZY); + strlen_fn = dlsym(dl_handle, "test_strlen"); if (!strlen_fn) strlen_fn = strlen; @@ -134,6 +136,7 @@ ATF_TC_BODY(strlen_basic, tc) } } } + (void)dlclose(dl_handle); } ATF_TC(strlen_huge); |
