mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:24:13 +08:00
mdbx: avoids infinite copy_file_range-loop when file is unexpectedly truncated.
Change-Id: I5a542a49fa4ac9ced8ca60266a084d52d3618804
This commit is contained in:
parent
30ac62ceec
commit
41de36e93d
@ -11652,8 +11652,8 @@ static int __cold mdbx_env_copy_asis(MDBX_env *env, MDBX_txn *read_txn,
|
||||
off_t out_offset = in_offset;
|
||||
ssize_t bytes_copied = copy_file_range(
|
||||
env->me_fd, &in_offset, fd, &out_offset, data_bytes - in_offset, 0);
|
||||
if (bytes_copied < 0) {
|
||||
rc = errno;
|
||||
if (unlikely(bytes_copied <= 0)) {
|
||||
rc = bytes_copied ? errno : MDBX_ENODATA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user