diff --git a/src/elements/core.c b/src/elements/core.c index 25f4cd3f..b7afb73a 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -3699,6 +3699,8 @@ static __cold int mdbx_mapresize(MDBX_env *env, const pgno_t used_pgno, mdbx_assert(env, limit_bytes >= size_bytes); mdbx_assert(env, bytes2pgno(env, size_bytes) >= size_pgno); mdbx_assert(env, bytes2pgno(env, limit_bytes) >= limit_pgno); + const size_t prev_limit = env->me_dxb_mmap.limit; + const void *const prev_addr = env->me_map; #if defined(_WIN32) || defined(_WIN64) /* Acquire guard in exclusive mode for: @@ -3739,8 +3741,6 @@ static __cold int mdbx_mapresize(MDBX_env *env, const pgno_t used_pgno, goto bailout; #endif /* Windows */ - const size_t prev_limit = env->me_dxb_mmap.limit; - const void *const prev_addr = env->me_map; const size_t prev_size = env->me_dxb_mmap.current; if (size_bytes < prev_size) { mdbx_notice("resize-MADV_%s %u..%u", diff --git a/src/elements/osal.c b/src/elements/osal.c index 8f7061c6..e1334cca 100644 --- a/src/elements/osal.c +++ b/src/elements/osal.c @@ -1134,17 +1134,24 @@ static int mdbx_check_fs_local(mdbx_filehandle_t handle, int flags) { #if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || \ (defined(_DEFAULT_SOURCE) && __GLIBC_PREREQ(2, 19)) struct mntent entbuf; + const bool should_copy = false; while (nullptr != (ent = getmntent_r(mounted, &entbuf, pathbuf, sizeof(pathbuf)))) #else + const bool should_copy = true; while (nullptr != (ent = getmntent(mounted)))) #endif { struct stat mnt; if (!stat(ent->mnt_dir, &mnt) && mnt.st_dev == st.st_dev) { - name = - strncpy(pathbuf, ent->mnt_fsname, name_len = sizeof(pathbuf) - 1); - pathbuf[name_len] = 0; + if (should_copy) { + name = + strncpy(pathbuf, ent->mnt_fsname, name_len = sizeof(pathbuf) - 1); + pathbuf[name_len] = 0; + } else { + name = ent->mnt_fsname; + name_len = strlen(name); + } break; } }