mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-21 21:58:20 +08:00
mdbx: fix Valgrind issue (minor).
Change-Id: Ia651a29a0eac7a1279dd7cb30b3247a1f41ab37e
This commit is contained in:
parent
398b90fb1c
commit
5cb7989e8d
@ -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, limit_bytes >= size_bytes);
|
||||||
mdbx_assert(env, bytes2pgno(env, size_bytes) >= size_pgno);
|
mdbx_assert(env, bytes2pgno(env, size_bytes) >= size_pgno);
|
||||||
mdbx_assert(env, bytes2pgno(env, limit_bytes) >= limit_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)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
/* Acquire guard in exclusive mode for:
|
/* 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;
|
goto bailout;
|
||||||
#endif /* Windows */
|
#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;
|
const size_t prev_size = env->me_dxb_mmap.current;
|
||||||
if (size_bytes < prev_size) {
|
if (size_bytes < prev_size) {
|
||||||
mdbx_notice("resize-MADV_%s %u..%u",
|
mdbx_notice("resize-MADV_%s %u..%u",
|
||||||
|
@ -1134,17 +1134,24 @@ static int mdbx_check_fs_local(mdbx_filehandle_t handle, int flags) {
|
|||||||
#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || \
|
#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || \
|
||||||
(defined(_DEFAULT_SOURCE) && __GLIBC_PREREQ(2, 19))
|
(defined(_DEFAULT_SOURCE) && __GLIBC_PREREQ(2, 19))
|
||||||
struct mntent entbuf;
|
struct mntent entbuf;
|
||||||
|
const bool should_copy = false;
|
||||||
while (nullptr !=
|
while (nullptr !=
|
||||||
(ent = getmntent_r(mounted, &entbuf, pathbuf, sizeof(pathbuf))))
|
(ent = getmntent_r(mounted, &entbuf, pathbuf, sizeof(pathbuf))))
|
||||||
#else
|
#else
|
||||||
|
const bool should_copy = true;
|
||||||
while (nullptr != (ent = getmntent(mounted))))
|
while (nullptr != (ent = getmntent(mounted))))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct stat mnt;
|
struct stat mnt;
|
||||||
if (!stat(ent->mnt_dir, &mnt) && mnt.st_dev == st.st_dev) {
|
if (!stat(ent->mnt_dir, &mnt) && mnt.st_dev == st.st_dev) {
|
||||||
name =
|
if (should_copy) {
|
||||||
strncpy(pathbuf, ent->mnt_fsname, name_len = sizeof(pathbuf) - 1);
|
name =
|
||||||
pathbuf[name_len] = 0;
|
strncpy(pathbuf, ent->mnt_fsname, name_len = sizeof(pathbuf) - 1);
|
||||||
|
pathbuf[name_len] = 0;
|
||||||
|
} else {
|
||||||
|
name = ent->mnt_fsname;
|
||||||
|
name_len = strlen(name);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user