]> sourceware.org Git - glibc.git/blobdiff - io/file_change_detection.c
support: Use macros for *stat wrappers
[glibc.git] / io / file_change_detection.c
index c6d700ed05acc4ca09169b39af45fd6f3a38d4f9..30c6828a52789fffe730d1d703cc6f25f0c623c0 100644 (file)
@@ -1,5 +1,5 @@
 /* Detecting file changes using modification times.
-   Copyright (C) 2017-2020 Free Software Foundation, Inc.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -44,7 +44,7 @@ libc_hidden_def (__file_is_unchanged)
 
 void
 __file_change_detection_for_stat (struct file_change_detection *file,
-                                  const struct stat64 *st)
+                                  const struct __stat64_t64 *st)
 {
   if (S_ISDIR (st->st_mode))
     /* Treat as empty file.  */
@@ -56,8 +56,10 @@ __file_change_detection_for_stat (struct file_change_detection *file,
     {
       file->size = st->st_size;
       file->ino = st->st_ino;
-      file->mtime = st->st_mtim;
-      file->ctime = st->st_ctim;
+      file->mtime = (struct __timespec64) { st->st_mtim.tv_sec,
+                                           st->st_mtim.tv_nsec };
+      file->ctime = (struct __timespec64) { st->st_ctim.tv_sec,
+                                           st->st_ctim.tv_nsec };
     }
 }
 libc_hidden_def (__file_change_detection_for_stat)
@@ -66,8 +68,8 @@ bool
 __file_change_detection_for_path (struct file_change_detection *file,
                                   const char *path)
 {
-  struct stat64 st;
-  if (stat64 (path, &st) != 0)
+  struct __stat64_t64 st;
+  if (__stat64_time64 (path, &st) != 0)
     switch (errno)
       {
       case EACCES:
@@ -84,7 +86,7 @@ __file_change_detection_for_path (struct file_change_detection *file,
         /* Other errors are fatal.  */
         return false;
       }
-  else /* stat64 was successfull.  */
+  else /* stat64 was successful.  */
     {
       __file_change_detection_for_stat (file, &st);
       return true;
@@ -104,8 +106,8 @@ __file_change_detection_for_fp (struct file_change_detection *file,
     }
   else
     {
-      struct stat64 st;
-      if (fstat64 (__fileno (fp), &st) != 0)
+      struct __stat64_t64 st;
+      if (__fstat64_time64 (__fileno (fp), &st) != 0)
         /* If we already have a file descriptor, all errors are fatal.  */
         return false;
       else
This page took 0.029493 seconds and 5 git commands to generate.