Commit 0823ffc2f6c509dbcedfb15d0d1011a253b45ef9

Christian Weisgerber 2020-09-10T20:44:40

use modern POSIX timestamp fields in struct stat ok stsp

diff --git a/lib/fileindex.c b/lib/fileindex.c
index 1e59fdb..04443aa 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -105,10 +105,10 @@ got_fileindex_entry_update(struct got_fileindex_entry *ie,
 
 	if ((ie->flags & GOT_FILEIDX_F_NO_FILE_ON_DISK) == 0) {
 		if (update_timestamps) {
-			ie->ctime_sec = sb.st_ctime;
-			ie->ctime_nsec = sb.st_ctimensec;
-			ie->mtime_sec = sb.st_mtime;
-			ie->mtime_nsec = sb.st_mtimensec;
+			ie->ctime_sec = sb.st_ctim.tv_sec;
+			ie->ctime_nsec = sb.st_ctim.tv_nsec;
+			ie->mtime_sec = sb.st_mtim.tv_sec;
+			ie->mtime_nsec = sb.st_mtim.tv_nsec;
 		}
 		ie->uid = sb.st_uid;
 		ie->gid = sb.st_gid;
diff --git a/lib/worktree.c b/lib/worktree.c
index 8afc4c2..3d078a5 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -1569,10 +1569,10 @@ xbit_differs(struct got_fileindex_entry *ie, uint16_t st_mode)
 static int
 stat_info_differs(struct got_fileindex_entry *ie, struct stat *sb)
 {
-	return !(ie->ctime_sec == sb->st_ctime &&
-	    ie->ctime_nsec == sb->st_ctimensec &&
-	    ie->mtime_sec == sb->st_mtime &&
-	    ie->mtime_nsec == sb->st_mtimensec &&
+	return !(ie->ctime_sec == sb->st_ctim.tv_sec &&
+	    ie->ctime_nsec == sb->st_ctim.tv_nsec &&
+	    ie->mtime_sec == sb->st_mtim.tv_sec &&
+	    ie->mtime_nsec == sb->st_mtim.tv_nsec &&
 	    ie->size == (sb->st_size & 0xffffffff) &&
 	    !xbit_differs(ie, sb->st_mode));
 }