git: e34c713b0e66 - main - rtld/tests: Avoid function name conflict with libc opendir()
Alex Richardson
arichardson at FreeBSD.org
Tue Jul 6 10:07:26 UTC 2021
The branch main has been updated by arichardson:
URL: https://cgit.FreeBSD.org/src/commit/?id=e34c713b0e660a49b57fafc02c9eccb26b938220
commit e34c713b0e660a49b57fafc02c9eccb26b938220
Author: Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-07-06 09:51:57 +0000
Commit: Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-07-06 09:51:57 +0000
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
---
libexec/rtld-elf/tests/common.c | 2 +-
libexec/rtld-elf/tests/common.h | 2 +-
libexec/rtld-elf/tests/ld_library_pathfds.c | 4 ++--
libexec/rtld-elf/tests/ld_preload_fds.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libexec/rtld-elf/tests/common.c b/libexec/rtld-elf/tests/common.c
index 6eb3edfbc14c..82dd5180b582 100644
--- a/libexec/rtld-elf/tests/common.c
+++ b/libexec/rtld-elf/tests/common.c
@@ -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);
diff --git a/libexec/rtld-elf/tests/common.h b/libexec/rtld-elf/tests/common.h
index d5bf2050dcfd..12a9eec36eb5 100644
--- a/libexec/rtld-elf/tests/common.h
+++ b/libexec/rtld-elf/tests/common.h
@@ -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_ */
diff --git a/libexec/rtld-elf/tests/ld_library_pathfds.c b/libexec/rtld-elf/tests/ld_library_pathfds.c
index bc0627d4c3d5..ed9f51c175fa 100644
--- a/libexec/rtld-elf/tests/ld_library_pathfds.c
+++ b/libexec/rtld-elf/tests/ld_library_pathfds.c
@@ -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);
}
diff --git a/libexec/rtld-elf/tests/ld_preload_fds.c b/libexec/rtld-elf/tests/ld_preload_fds.c
index 3a220b009bb6..99378b549de5 100644
--- a/libexec/rtld-elf/tests/ld_preload_fds.c
+++ b/libexec/rtld-elf/tests/ld_preload_fds.c
@@ -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);
More information about the dev-commits-src-all
mailing list