mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
MDEV-14132 follow-up fix: Validate the posix_fallocate() argument
os_file_set_size(): Sometimes the file already is large enough. Avoid calling posix_fallocate() with a non-positive argument. Also, add a missing space to an error message.
This commit is contained in:
parent
057a6cf768
commit
5f5ffdc76b
1 changed files with 4 additions and 2 deletions
|
@ -5382,14 +5382,16 @@ fallback:
|
|||
int err;
|
||||
do {
|
||||
os_offset_t current_size = os_file_get_size(file);
|
||||
err = posix_fallocate(file, current_size, size - current_size);
|
||||
err = current_size >= size
|
||||
? 0 : posix_fallocate(file, current_size,
|
||||
size - current_size);
|
||||
} while (err == EINTR
|
||||
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
|
||||
|
||||
if (err) {
|
||||
ib::error() <<
|
||||
"preallocating " << size << " bytes for" <<
|
||||
"file " << name << "failed with error " << err;
|
||||
"file " << name << " failed with error " << err;
|
||||
}
|
||||
errno = err;
|
||||
return(!err);
|
||||
|
|
Loading…
Reference in a new issue