From fbd232ed0cd304f654b8844939b2a4de6bf703fe Mon Sep 17 00:00:00 2001 From: David Goldman Date: Tue, 23 Aug 2022 17:54:50 -0400 Subject: [PATCH] Improve support for mounted file systems on macOS Some mounted file systems report a creation time of 0 - we still want to support these systems reporting a file as created and modified and properly treat it as created. --- src/macos/FSEventsBackend.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/macos/FSEventsBackend.cc b/src/macos/FSEventsBackend.cc index 793b347f..259ef312 100644 --- a/src/macos/FSEventsBackend.cc +++ b/src/macos/FSEventsBackend.cc @@ -126,7 +126,8 @@ void FSEventsCallback( uint64_t ctime = CONVERT_TIME(file.st_birthtimespec); uint64_t mtime = CONVERT_TIME(file.st_mtimespec); auto existed = !since && state->tree->find(paths[i]); - if (isModified && (existed || ctime <= since)) { + // Some mounted file systems report a creation time of 0/unix epoch which we special case. + if (isModified && (existed || (ctime <= since && ctime != 0))) { state->tree->update(paths[i], mtime); list->update(paths[i]); } else {