mdbx: set DXB/LCK files position outside of a data.

Set the position in files outside of the data to avoid corruption
due to erroneous use of file descriptors in the application code.

Change-Id: I8750f6e726edaddee254885756d5f91576a6bcb1
This commit is contained in:
Leonid Yuriev 2020-11-23 09:25:24 +03:00
parent f76bf72021
commit ddee04d991

View File

@ -10806,6 +10806,13 @@ __cold int mdbx_env_open(MDBX_env *env, const char *pathname,
goto bailout;
}
/* Set the position in files outside of the data to avoid corruption
* due to erroneous use of file descriptors in the application code. */
mdbx_fseek(env->me_lfd, UINT64_C(1) << 63);
mdbx_fseek(env->me_lazy_fd, UINT64_C(1) << 63);
if (env->me_dsync_fd != INVALID_HANDLE_VALUE)
mdbx_fseek(env->me_dsync_fd, UINT64_C(1) << 63);
const MDBX_env_flags_t rigorous_flags =
MDBX_SAFE_NOSYNC | MDBX_DEPRECATED_MAPASYNC;
const MDBX_env_flags_t mode_flags = rigorous_flags | MDBX_NOMETASYNC |