Merge pull request #102 from the-real-tokai/fix-fdatasync-osx

Fix problematic fdatasync() call on macOS
This commit is contained in:
Alexandre Dulaunoy 2024-04-23 17:15:07 +02:00 committed by GitHub
commit d02412720b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,7 +54,11 @@ static int init_pcap_logger(void *data) {
}
static int deinit_pcap_logger(void) {
fdatasync(pcap_fd);
#if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0)
fdatasync(pcap_fd);
#else
fsync(pcap_fd);
#endif
close(pcap_fd);
return 0;
}