Commit 098ffa66 authored by Max Reitz's avatar Max Reitz Committed by Kevin Wolf

block/raw-posix: Catch fsync() errors

fsync() may fail, and that case should be handled.
Reported-by: default avatarLászló Érsek <lersek@redhat.com>
Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 731de380
......@@ -1454,7 +1454,12 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
left -= result;
}
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);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment