rtld/tests: Avoid function name conflict with libc opendir()

This prevents these tests from being compiled with ASAN since the asan
interceptors also define opendir() but matching the libc function.

Reviewed By:	oshogbo, kib, markj
Differential Revision: https://reviews.freebsd.org/D31038
This commit is contained in:
Alex Richardson 2021-07-06 10:51:57 +01:00
parent 4d552825ec
commit e34c713b0e
4 changed files with 5 additions and 5 deletions

View File

@ -67,7 +67,7 @@ try_to_run(int binary, int exit_status, char * const *env,
}
int
opendir(const char *name)
opendir_fd(const char *name)
{
return open(name, O_RDONLY | O_DIRECTORY);

View File

@ -37,7 +37,7 @@ void expect_missing_library(int binary, char *senv);
void try_to_run(int binary, int expected_exit_status, char * const *env,
const char *expected_out, const char *expected_err);
int opendir(const char *name);
int opendir_fd(const char *name);
int opendirat(int parent, const char *name);
#endif /* _LD_COMMON_H_ */

View File

@ -159,12 +159,12 @@ static void
setup(struct descriptors *dp, const atf_tc_t *tc)
{
dp->testdir = opendir(atf_tc_get_config_var(tc, "srcdir"));
dp->testdir = opendir_fd(atf_tc_get_config_var(tc, "srcdir"));
ATF_REQUIRE(dp->testdir >= 0);
ATF_REQUIRE(
(dp->binary = openat(dp->testdir, TARGET_ELF_NAME, O_RDONLY)) >= 0);
ATF_REQUIRE((dp->root = opendir("/")) >= 0);
ATF_REQUIRE((dp->root = opendir_fd("/")) >= 0);
ATF_REQUIRE((dp->etc = opendirat(dp->root, "etc")) >= 0);
ATF_REQUIRE((dp->usr = opendirat(dp->root, "usr")) >= 0);
}

View File

@ -39,7 +39,7 @@ setup(const atf_tc_t *tc)
{
int testdir;
testdir = opendir(atf_tc_get_config_var(tc, "srcdir"));
testdir = opendir_fd(atf_tc_get_config_var(tc, "srcdir"));
ATF_REQUIRE(testdir >= 0);
binaryfd = openat(testdir, TARGET_ELF_NAME, O_RDONLY);