rtld tests: Don't use RZ for dlinfo.

Use

	ATF_REQUIRE_EQ_MSG(dlinfo(...), 0, "dlinfo: %s", dlerror())

instead, in order to accurately report the error on failure.  RZ is
only for functions like pthread_create(3) that return zero on success
and errno(3) code on failure, but dlinfo returns -1 on failure and
sets dlerror() to report the nature of the error.
This commit is contained in:
riastradh 2023-11-24 17:40:09 +00:00
parent ef23f679e4
commit e441ef5517
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_dlinfo.c,v 1.6 2019/07/09 16:24:01 maya Exp $ */
/* $NetBSD: t_dlinfo.c,v 1.7 2023/11/24 17:40:09 riastradh Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -97,7 +97,8 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_iter, tc)
handle = dlopen("libutil.so", RTLD_LAZY);
ATF_CHECK(handle);
RZ(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map));
ATF_REQUIRE_EQ_MSG(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map), 0,
"dlinfo: %s", dlerror());
for (; map->l_next; map = map->l_next)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_rtld_r_debug.c,v 1.3 2020/09/29 16:35:42 roy Exp $ */
/* $NetBSD: t_rtld_r_debug.c,v 1.4 2023/11/24 17:40:09 riastradh Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@ -150,7 +150,8 @@ ATF_TC_BODY(dlopen, tc)
check_r_debug_return_link_map("libutil.so", &r_map);
RZ(dlinfo(handle, RTLD_DI_LINKMAP, &map));
ATF_REQUIRE_EQ_MSG(dlinfo(handle, RTLD_DI_LINKMAP, &map), 0,
"dlinfo: %s", dlerror());
ATF_CHECK(map == r_map);
dlclose(handle);