about summary refs log tree commit diff
path: root/io
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-10 10:09:51 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-10 13:48:26 +0200
commitacc85ea1eb046eee9296fbc4803b82cb485ced07 (patch)
tree75c71013612a2746728ffd1f446b1abbe93e8ced /io
parent8fe503f74e0a2ab41eec9bbae1e0ea8f5203716b (diff)
downloadglibc-acc85ea1eb046eee9296fbc4803b82cb485ced07.tar.gz
glibc-acc85ea1eb046eee9296fbc4803b82cb485ced07.tar.xz
glibc-acc85ea1eb046eee9296fbc4803b82cb485ced07.zip
io: Fix sporadic test failures in io/tst-stat
support_stat_nanoseconds cannot restore the ctime time, and
this may lead to sporadic test failures.  Therefore, probe for
nanoseconds support before the initial statx call.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'io')
-rw-r--r--io/tst-stat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/io/tst-stat.c b/io/tst-stat.c
index b3e8dc2170..82e965de6a 100644
--- a/io/tst-stat.c
+++ b/io/tst-stat.c
@@ -69,15 +69,15 @@ do_test (void)
   TEST_VERIFY_EXIT (fd >= 0);
   support_write_file_string (path, "abc");
 
+  bool check_ns = support_stat_nanoseconds (path);
+  if (!check_ns)
+    printf ("warning: timestamp with nanoseconds not supported\n");
+
   struct statx stx;
   TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0);
 
   test_t tests[] = { stat_check, lstat_check, fstat_check, fstatat_check };
 
-  bool check_ns = support_stat_nanoseconds (path);
-  if (!check_ns)
-    printf ("warning: timestamp with nanoseconds not supported\n");
-
   for (int i = 0; i < array_length (tests); i++)
     {
       struct stat st;