Skip to content

Instantly share code, notes, and snippets.

@yurikoles
Created March 15, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurikoles/59aae0c0a83e771fb1e730a2e9dd9180 to your computer and use it in GitHub Desktop.
Save yurikoles/59aae0c0a83e771fb1e730a2e9dd9180 to your computer and use it in GitHub Desktop.
--- a/src/lowntfs-3g.c
+++ b/src/lowntfs-3g.c
@@ -1989,15 +1989,41 @@
if (to_set & FUSE_SET_ATTR_ATIME_NOW)
mask |= NTFS_UPDATE_ATIME;
else
- if (to_set & FUSE_SET_ATTR_ATIME)
+ if (to_set & FUSE_SET_ATTR_ATIME) {
+#ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC
+ ni->last_access_time
+ = timespec2ntfs(stin->st_atimespec);
+#elif defined(HAVE_STRUCT_STAT_ST_ATIM)
ni->last_access_time
= timespec2ntfs(stin->st_atim);
+#else
+ ni->last_access_time.tv_sec
+ = stin->st_atime;
+#ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
+ ni->last_access_time.tv_nsec
+ = stin->st_atimensec;
+#endif
+#endif
+ }
if (to_set & FUSE_SET_ATTR_MTIME_NOW)
mask |= NTFS_UPDATE_MTIME;
else
- if (to_set & FUSE_SET_ATTR_MTIME)
+ if (to_set & FUSE_SET_ATTR_MTIME) {
+#ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC
+ ni->last_data_change_time
+ = timespec2ntfs(stin->st_mtimespec);
+#elif defined(HAVE_STRUCT_STAT_ST_ATIM)
ni->last_data_change_time
= timespec2ntfs(stin->st_mtim);
+#else
+ ni->last_data_change_time.tv_sec
+ = stin->st_mtime;
+#ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
+ ni->last_data_change_time.tv_nsec
+ = stin->st_mtimensec;
+#endif
+#endif
+ }
ntfs_inode_update_times(ni, mask);
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
} else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment