]> git.proxmox.com Git - qemu.git/commitdiff
block/vpc: write checksum back to footer after check
authorZhang Shengju <zhangsju@gmail.com>
Tue, 13 Mar 2012 14:38:13 +0000 (22:38 +0800)
committerKevin Wolf <kwolf@redhat.com>
Thu, 5 Apr 2012 12:54:40 +0000 (14:54 +0200)
After validation check, the 'checksum' is not written back
to footer, which leave it with zero.

This results in errors while loadding it under Microsoft's
Hyper-V environment, and also errors from utilities like
Citrix's vhd-util.

Signed-off-by: Zhang Shengju <sean_zhang@trendmicro.com.cn>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vpc.c

index 706faf3f384d13c485ebfcf11b68ec4bf6b312fe..5cd13d17a11efd31a6753c30daee514a776e25fe 100644 (file)
@@ -189,6 +189,9 @@ static int vpc_open(BlockDriverState *bs, int flags)
         fprintf(stderr, "block-vpc: The header checksum of '%s' is "
             "incorrect.\n", bs->filename);
 
+    /* Write 'checksum' back to footer, or else will leave it with zero. */
+    footer->checksum = be32_to_cpu(checksum);
+
     // The visible size of a image in Virtual PC depends on the geometry
     // rather than on the size stored in the footer (the size in the footer
     // is too large usually)