From: kero Date: Thu, 9 Jan 2025 14:56:00 +0000 (+0000) Subject: ITS#10296 lmdb: fix fdatasync on MacOS X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc757af206f965d6b281e384441d3a7d93f9d017;p=thirdparty%2Fopenldap.git ITS#10296 lmdb: fix fdatasync on MacOS Patch from kero, with corrections by hyc --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 0dea5c63f4..da62da718e 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -170,7 +170,11 @@ typedef SSIZE_T ssize_t; # if !(defined(MDB_USE_POSIX_MUTEX) || defined(MDB_USE_POSIX_SEM)) # define MDB_USE_SYSV_SEM 1 # endif +# if defined(__APPLE__) +# define MDB_FDATASYNC(fd) fcntl(fd, F_FULLSYNC) +# else # define MDB_FDATASYNC fsync +# endif #elif defined(__ANDROID__) # define MDB_FDATASYNC fsync #endif @@ -3075,7 +3079,7 @@ mdb_env_sync0(MDB_env *env, int force, pgno_t numpgs) ? MS_ASYNC : MS_SYNC; if (MDB_MSYNC(env->me_map, env->me_psize * numpgs, flags)) rc = ErrCode(); -#ifdef _WIN32 +#if defined(_WIN32) || defined(__APPLE__) else if (flags == MS_SYNC && MDB_FDATASYNC(env->me_fd)) rc = ErrCode(); #endif