mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 09:32:06 +08:00
mdbx: minor fix mdbx_mresize()
to preserve result code for read-only cases.
This commit is contained in:
parent
1740043678
commit
728e7f92b2
14
src/osal.c
14
src/osal.c
@ -1777,19 +1777,19 @@ retry_mapview:;
|
||||
}
|
||||
|
||||
if (limit == map->limit)
|
||||
return MDBX_SUCCESS;
|
||||
return rc;
|
||||
|
||||
if (limit < map->limit) {
|
||||
/* unmap an excess at end of mapping. */
|
||||
if (unlikely(munmap(map->dxb + limit, map->limit - limit)))
|
||||
return errno;
|
||||
map->limit = limit;
|
||||
return MDBX_SUCCESS;
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = check_mmap_limit(limit);
|
||||
if (unlikely(rc != MDBX_SUCCESS))
|
||||
return rc;
|
||||
int err = check_mmap_limit(limit);
|
||||
if (unlikely(err != MDBX_SUCCESS))
|
||||
return err;
|
||||
|
||||
assert(limit > map->limit);
|
||||
uint8_t *ptr = MAP_FAILED;
|
||||
@ -1798,7 +1798,7 @@ retry_mapview:;
|
||||
ptr = mremap(map->address, map->limit, limit,
|
||||
(flags & MDBX_MRESIZE_MAY_MOVE) ? MREMAP_MAYMOVE : 0);
|
||||
if (ptr == MAP_FAILED) {
|
||||
const int err = errno;
|
||||
err = errno;
|
||||
switch (err) {
|
||||
default:
|
||||
return err;
|
||||
@ -1829,7 +1829,7 @@ retry_mapview:;
|
||||
return errno;
|
||||
ptr = MAP_FAILED;
|
||||
} else {
|
||||
const int err = errno;
|
||||
err = errno;
|
||||
switch (err) {
|
||||
default:
|
||||
return err;
|
||||
|
Loading…
x
Reference in New Issue
Block a user