#==================================================================================================
# Patch to replace use of fdatasync(), with fsync()
#
# Author: Christopher Nielsen @ MacPorts
# Date:   2023-10-08
#==================================================================================================
--- meson.build.orig	2023-11-12 03:52:33.000000000 -0500
+++ meson.build	2024-04-23 14:57:28.000000000 -0400
@@ -49,7 +49,7 @@
 ###############################################################################
 # Dependencies
 
-config.set('HAVE_FDATASYNC', cc.has_function('fdatasync', prefix: '#include <unistd.h>'))
+config.set('HAVE_FDATASYNC', cc.has_function('fsync', prefix: '#include <unistd.h>'))
 
 
 if get_option('build-translations')
--- src/update-mime-database.cpp
+++ src/update-mime-database.cpp
@@ -934,7 +934,7 @@
 			    g_strerror(errsv));
 }
 
-#ifdef HAVE_FDATASYNC
+#ifdef HAVE_FSYNC
 static gboolean
 sync_enabled(void)
 {
@@ -950,7 +950,7 @@
 static int
 sync_file(const gchar *pathname, GError **error)
 {
-#ifdef HAVE_FDATASYNC
+#ifdef HAVE_FSYNC
 	int fd;
 
 	if (!sync_enabled())
@@ -962,7 +962,7 @@
 		set_error_from_errno(error);
 		return -1;
 	}
-	if (fdatasync(fd) == -1)
+	if (fsync(fd) == -1)
 	{
 		set_error_from_errno(error);
 		close(fd);
