Message ID | 1416306186-19053-4-git-send-email-mreitz@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/block/raw-posix.c b/block/raw-posix.c index f67fb11..666cdec 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1460,7 +1460,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;
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> --- block/raw-posix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)