aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorZhang Shengju <zhangsju@gmail.com>2012-03-13 22:38:13 +0800
committerKevin Wolf <kwolf@redhat.com>2012-04-05 14:54:40 +0200
commitc088b691363070d151f80cc1fde4b7c151bdfe8f (patch)
tree8f8d6031b7763fedea91e89a5007b5c4b0d00784 /block
parent95ebda85e09ed2b7f00deb2adbdafa5ccf5db948 (diff)
block/vpc: write checksum back to footer after check
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>
Diffstat (limited to 'block')
-rw-r--r--block/vpc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/vpc.c b/block/vpc.c
index 706faf3f38..5cd13d17a1 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -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)