From 01797cf1bc9993423f2966c48800266f75ba0e4b Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Fri, 1 Mar 2019 13:29:15 +0300 Subject: [PATCH] mdbx: env_open() consider zero mode_t as open-existing flag. Change-Id: I6f9dbf2059822afaba4c3de8f4ce380613a7dc36 --- src/mdbx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);