diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 1eb8e33a7a..730ca7b52f 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -324,12 +324,13 @@ static int createRawFileOpHook(int fd, void *data) { } } - if (fsync(fd) < 0) { - ret = errno; - virReportSystemError(errno, _("cannot sync data to file '%s'"), - hdata->vol->target.path); - goto cleanup; - } + } + + if (fsync(fd) < 0) { + ret = errno; + virReportSystemError(errno, _("cannot sync data to file '%s'"), + hdata->vol->target.path); + goto cleanup; } cleanup: