]> Git Repo - qemu.git/commitdiff
qcow2: Fix error handling in grow_refcount_table
authorKevin Wolf <[email protected]>
Wed, 20 Jan 2010 14:03:03 +0000 (15:03 +0100)
committerAnthony Liguori <[email protected]>
Tue, 26 Jan 2010 20:59:19 +0000 (14:59 -0600)
Return the appropriate error code instead of -EIO.

Signed-off-by: Kevin Wolf <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
block/qcow2-refcount.c

index 3a2d44a170ca492aaccadb2af2ffa8cd249f5994..6f449c6a70c94afcac3f004f9bef81bd8a60387b 100644 (file)
@@ -168,9 +168,12 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
 
     cpu_to_be64w((uint64_t*)data, table_offset);
     cpu_to_be32w((uint32_t*)(data + 8), refcount_table_clusters);
-    if (bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset),
-                    data, sizeof(data)) != sizeof(data))
+    ret = bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset),
+                    data, sizeof(data));
+    if (ret != sizeof(data)) {
         goto fail;
+    }
+
     qemu_free(s->refcount_table);
     old_table_offset = s->refcount_table_offset;
     old_table_size = s->refcount_table_size;
@@ -183,7 +186,7 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
     return 0;
  fail:
     qemu_free(new_table);
-    return -EIO;
+    return ret < 0 ? ret : -EIO;
 }
 
 
This page took 0.029355 seconds and 4 git commands to generate.