aboutsummaryrefslogtreecommitdiff
path: root/io/tst-utime.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-08-16 16:05:20 +0200
committerFlorian Weimer <fweimer@redhat.com>2024-08-16 16:05:20 +0200
commitbf2927484152e12996af60ea439cf94b66fcd81d (patch)
tree10b66543486ca858cfe88fb204dbc0df67c27f36 /io/tst-utime.c
parent921690512946d73bf66a8c495baff31316e4489f (diff)
downloadglibc-bf2927484152e12996af60ea439cf94b66fcd81d.zip
glibc-bf2927484152e12996af60ea439cf94b66fcd81d.tar.gz
glibc-bf2927484152e12996af60ea439cf94b66fcd81d.tar.bz2
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 <adhemerval.zanella@linaro.org>
Diffstat (limited to 'io/tst-utime.c')
-rw-r--r--io/tst-utime.c13
1 files changed, 5 insertions, 8 deletions
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 <utime.h>
#include <support/check.h>
#include <support/xunistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
-#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;
}