raw-posix: Fix bdrv_flush error return values
authorKevin Wolf <kwolf@redhat.com>
Wed, 14 Sep 2011 09:22:26 +0000 (11:22 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 19 Sep 2011 09:34:33 +0000 (11:34 +0200)
bdrv_flush is supposed to use 0/-errno return values

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/raw-posix.c

index a624f56f8680a8f147c237492a8bafeae61b3d98..305998ddb3b52259f79be3c760e270021109aab0 100644 (file)
@@ -839,7 +839,14 @@ static int raw_create(const char *filename, QEMUOptionParameter *options)
 static int raw_flush(BlockDriverState *bs)
 {
     BDRVRawState *s = bs->opaque;
-    return qemu_fdatasync(s->fd);
+    int ret;
+
+    ret = qemu_fdatasync(s->fd);
+    if (ret < 0) {
+        return -errno;
+    }
+
+    return 0;
 }
 
 #ifdef CONFIG_XFS