From e7c14e542d8d858b824b5df4f4e3dc93695e6171 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 16 Aug 2024 16:05:20 +0200 Subject: support: Use macros for *stat wrappers Macros will automatically use the correct types, without having to fiddle with internal glibc macros. It's also impossible to get the types wrong due to aliasing because support_check_stat_fd and support_check_stat_path do not depend on the struct stat* types. The changes reveal some inconsistencies in tests. Reviewed-by: Adhemerval Zanella --- io/tst-copy_file_range.c | 2 +- io/tst-statx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'io') diff --git a/io/tst-copy_file_range.c b/io/tst-copy_file_range.c index 9837b7c339..3d7b0aa901 100644 --- a/io/tst-copy_file_range.c +++ b/io/tst-copy_file_range.c @@ -117,7 +117,7 @@ simple_file_copy (void) TEST_COMPARE (xlseek (outfd, 0, SEEK_CUR), 6 + length); struct stat64 st; - xfstat (outfd, &st); + xfstat64 (outfd, &st); if (length > 0) TEST_COMPARE (st.st_size, out_skipped + length); else diff --git a/io/tst-statx.c b/io/tst-statx.c index d84568859e..685924ae76 100644 --- a/io/tst-statx.c +++ b/io/tst-statx.c @@ -78,7 +78,7 @@ both_implementations_tests (statx_function impl, const char *path, int fd) struct statx stx = { 0, }; TEST_COMPARE (statx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &stx), 0); struct stat64 st; - xfstat (fd, &st); + xfstat64 (fd, &st); TEST_COMPARE (stx.stx_mode, st.st_mode); TEST_COMPARE (stx.stx_dev_major, major (st.st_dev)); TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev)); @@ -88,7 +88,7 @@ both_implementations_tests (statx_function impl, const char *path, int fd) TEST_COMPARE (statx (AT_FDCWD, "/dev/null", 0, STATX_BASIC_STATS, &stx), 0); struct stat64 st; - xstat ("/dev/null", &st); + xstat64 ("/dev/null", &st); TEST_COMPARE (stx.stx_mode, st.st_mode); TEST_COMPARE (stx.stx_dev_major, major (st.st_dev)); TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev)); -- cgit v1.2.3