From owner-svn-src-stable-10@freebsd.org Sat Jan 7 09:17:47 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3966CC9E59E; Sat, 7 Jan 2017 09:17:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3357158B; Sat, 7 Jan 2017 09:17:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v079Hkoo094999; Sat, 7 Jan 2017 09:17:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v079HkOR094997; Sat, 7 Jan 2017 09:17:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701070917.v079HkOR094997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 7 Jan 2017 09:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r311611 - stable/10/contrib/netbsd-tests/lib/libc/string X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2017 09:17:47 -0000 Author: ngie Date: Sat Jan 7 09:17:45 2017 New Revision: 311611 URL: https://svnweb.freebsd.org/changeset/base/311611 Log: MFC r311249: {strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use CID: 978299, 978300 Modified: stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c Sat Jan 7 09:16:22 2017 (r311610) +++ stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c Sat Jan 7 09:17:45 2017 (r311611) @@ -58,6 +58,9 @@ ATF_TC_HEAD(strchr_basic, tc) ATF_TC_BODY(strchr_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif unsigned int t, a; char *off; char buf[32]; @@ -245,8 +248,12 @@ ATF_TC_BODY(strchr_basic, tc) "abcdefgh/abcdefgh/", }; - +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strchr_fn = dlsym(dl_handle, "test_strlen"); +#else strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr"); +#endif if (!strchr_fn) strchr_fn = strchr; @@ -281,6 +288,9 @@ ATF_TC_BODY(strchr_basic, tc) verify_strchr(buf + a, 0xff, t, a); } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TP_ADD_TCS(tp) Modified: stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c Sat Jan 7 09:16:22 2017 (r311610) +++ stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c Sat Jan 7 09:17:45 2017 (r311611) @@ -40,6 +40,9 @@ ATF_TC_HEAD(strlen_basic, tc) ATF_TC_BODY(strlen_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif /* try to trick the compiler */ size_t (*strlen_fn)(const char *); @@ -107,7 +110,12 @@ ATF_TC_BODY(strlen_basic, tc) * During testing it is useful have the rest of the program * use a known good version! */ +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strlen_fn = dlsym(dl_handle, "test_strlen"); +#else strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen"); +#endif if (!strlen_fn) strlen_fn = strlen; @@ -134,6 +142,9 @@ ATF_TC_BODY(strlen_basic, tc) } } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TC(strlen_huge);