diff --git a/src/cogs.h b/src/cogs.h index 075c2500..70836997 100644 --- a/src/cogs.h +++ b/src/cogs.h @@ -385,6 +385,10 @@ MDBX_CONST_FUNCTION static inline int ignore_enosys(int err) { MDBX_MAYBE_UNUSED MDBX_CONST_FUNCTION static inline int ignore_enosys_and_eagain(int err) { return (err == EAGAIN) ? MDBX_RESULT_TRUE : ignore_enosys(err); } + +MDBX_MAYBE_UNUSED MDBX_CONST_FUNCTION static inline int ignore_enosys_and_einval(int err) { + return (err == EINVAL) ? MDBX_RESULT_TRUE : ignore_enosys(err); +} #endif /* defined(_WIN32) || defined(_WIN64) */ static inline int check_env(const MDBX_env *env, const bool wanna_active) { diff --git a/src/lck-posix.c b/src/lck-posix.c index 6a0bfe55..fe30ba35 100644 --- a/src/lck-posix.c +++ b/src/lck-posix.c @@ -128,7 +128,8 @@ static int lck_op(const mdbx_filehandle_t fd, int cmd, const int lck, const off_ } rc = errno; #if MDBX_USE_OFDLOCKS - if (rc == EINVAL && (cmd == MDBX_F_OFD_SETLK || cmd == MDBX_F_OFD_SETLKW || cmd == MDBX_F_OFD_GETLK)) { + if (ignore_enosys_and_einval(rc) == MDBX_RESULT_TRUE && + (cmd == MDBX_F_OFD_SETLK || cmd == MDBX_F_OFD_SETLKW || cmd == MDBX_F_OFD_GETLK)) { /* fallback to non-OFD locks */ if (cmd == MDBX_F_OFD_SETLK) cmd = MDBX_F_SETLK;