Skip to content

Commit

Permalink
Fix issue #181 (should validate cfInode)
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhuang7215 committed Sep 4, 2024
1 parent 998c16e commit 529c30f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/efsw/FileWatcherFSEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ void FileWatcherFSEvents::FSEventCallback( ConstFSEventStreamRef streamRef, void
CFDictionaryGetValue( pathInfoDict, kFSEventStreamEventExtendedDataPathKey ) );
CFNumberRef cfInode = static_cast<CFNumberRef>(
CFDictionaryGetValue( pathInfoDict, kFSEventStreamEventExtendedFileIDKey ) );
unsigned long inode = 0;
CFNumberGetValue( cfInode, kCFNumberLongType, &inode );
events.push_back( FSEvent( convertCFStringToStdString( path ), (long)eventFlags[i],
(Uint64)eventIds[i], inode ) );

if ( cfInode ) {
unsigned long inode = 0;
CFNumberGetValue( cfInode, kCFNumberLongType, &inode );
events.push_back( FSEvent( convertCFStringToStdString( path ), (long)eventFlags[i],
(Uint64)eventIds[i], inode ) );
}
} else {
events.push_back( FSEvent( std::string( ( (char**)eventPaths )[i] ),
(long)eventFlags[i], (Uint64)eventIds[i] ) );
Expand Down

0 comments on commit 529c30f

Please sign in to comment.