diff options
-rw-r--r-- | block/raw-posix.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c index e0e48c5f51..d106fc456b 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1453,7 +1453,9 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp) } left -= result; } - fsync(fd); + if (result >= 0) { + fsync(fd); + } g_free(buf); break; } |