vpc: Add missing error handling in alloc_block
authorKevin Wolf <kwolf@redhat.com>
Wed, 23 Nov 2011 10:38:01 +0000 (11:38 +0100)
committerKevin Wolf <kwolf@redhat.com>
Wed, 23 Nov 2011 16:04:06 +0000 (17:04 +0100)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
block/vpc.c

index 75d7d4a..89a5ee2 100644 (file)
@@ -362,8 +362,11 @@ static int64_t alloc_block(BlockDriverState* bs, int64_t sector_num)
 
     // Initialize the block's bitmap
     memset(bitmap, 0xff, s->bitmap_size);
-    bdrv_pwrite_sync(bs->file, s->free_data_block_offset, bitmap,
+    ret = bdrv_pwrite_sync(bs->file, s->free_data_block_offset, bitmap,
         s->bitmap_size);
+    if (ret < 0) {
+        return ret;
+    }
 
     // Write new footer (the old one will be overwritten)
     s->free_data_block_offset += s->block_size + s->bitmap_size;