diff options
author | Max Reitz <mreitz@redhat.com> | 2014-11-18 11:23:06 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-11-18 12:09:00 +0100 |
commit | 098ffa6674a82ceac0e3ccb3a8a5bf6ca44adcd5 (patch) | |
tree | f8c989ea414934f2297a83eb36919b08f76a05ca /block | |
parent | 731de38052b245eab79e417aeac5e1dcebe6437f (diff) |
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/raw-posix.c | 7 |
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; |