Skip to content

Commit f0f7df6

Browse files
authored
macos: avoid open() calls on stat failures (#186)
this fixes sandboxd/tccd security dialogs when calling open() on files that are in other app containers
1 parent 9b7dac3 commit f0f7df6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/macos/FSEventsBackend.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void FSEventsCallback(
137137
// If multiple flags were set, then we need to call `stat` to determine if the file really exists.
138138
// This helps disambiguate creates, updates, and deletes.
139139
struct stat file;
140-
if (!pathExists(paths[i]) || stat(paths[i], &file)) {
140+
if (stat(paths[i], &file) || !pathExists(paths[i])) {
141141
// File does not exist, so we have to assume it was removed. This is not exact since the
142142
// flags set by fsevents get coalesced together (e.g. created & deleted), so there is no way to
143143
// know whether the create and delete both happened since our snapshot (in which case

0 commit comments

Comments
 (0)