aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/raw-posix.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index d106fc456b..b1af77e47f 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -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;