aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2014-11-18 11:23:06 +0100
committerKevin Wolf <kwolf@redhat.com>2014-11-18 12:09:00 +0100
commit098ffa6674a82ceac0e3ccb3a8a5bf6ca44adcd5 (patch)
treef8c989ea414934f2297a83eb36919b08f76a05ca
parent731de38052b245eab79e417aeac5e1dcebe6437f (diff)
downloadqemu-arm-098ffa6674a82ceac0e3ccb3a8a5bf6ca44adcd5.tar.gz
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>
-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;