From bf2927484152e12996af60ea439cf94b66fcd81d Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 16 Aug 2024 16:05:20 +0200 Subject: io: Use struct statx and xstatx in tests This avoids the need to define struct_statx to an appropriate struct stat type variant because struct statx does not change based on time/file offset flags. Reviewed-by: Adhemerval Zanella --- io/tst-utime.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'io/tst-utime.c') diff --git a/io/tst-utime.c b/io/tst-utime.c index e2e6dcd..f329358 100644 --- a/io/tst-utime.c +++ b/io/tst-utime.c @@ -19,26 +19,23 @@ #include #include #include +#include #include -#ifndef struct_stat -# define struct_stat struct stat64 -#endif - static int test_utime_helper (const char *file, int fd, const struct utimbuf *ut) { int result = utime (file, ut); TEST_VERIFY_EXIT (result == 0); - struct_stat st; - xfstat (fd, &st); + struct statx st; + xstatx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &st); /* Check if seconds for actime match */ - TEST_COMPARE (st.st_atime, ut->actime); + TEST_COMPARE (st.stx_atime.tv_sec, ut->actime); /* Check if seconds for modtime match */ - TEST_COMPARE (st.st_mtime, ut->modtime); + TEST_COMPARE (st.stx_mtime.tv_sec, ut->modtime); return 0; } -- cgit v1.1