mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
block/raw-posix: Catch fsync() errors
fsync() may fail, and that case should be handled. Reported-by: László Érsek <lersek@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
731de38052
commit
098ffa6674
1 changed files with 6 additions and 1 deletions
|
@ -1454,7 +1454,12 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
|
||||||
left -= result;
|
left -= result;
|
||||||
}
|
}
|
||||||
if (result >= 0) {
|
if (result >= 0) {
|
||||||
fsync(fd);
|
result = fsync(fd);
|
||||||
|
if (result < 0) {
|
||||||
|
result = -errno;
|
||||||
|
error_setg_errno(errp, -result,
|
||||||
|
"Could not flush new file to disk");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue