diff --git a/src/mdbx.c b/src/mdbx.c index 091b4921..bdf3185f 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -6489,8 +6489,10 @@ int __cold mdbx_env_open(MDBX_env *env, const char *path, unsigned flags, int oflags; if (F_ISSET(flags, MDBX_RDONLY)) oflags = O_RDONLY; - else + else if (mode != 0) oflags = O_RDWR | O_CREAT; + else + oflags = O_RDWR; rc = mdbx_openfile(dxb_pathname, oflags, mode, &env->me_fd, (env->me_flags & MDBX_EXCLUSIVE) ? true : false);