From 429f1548fe574772b431562661f64756cf1ccfe1 Mon Sep 17 00:00:00 2001 Message-Id: <429f1548fe574772b431562661f64756cf1ccfe1.1355928222.git.minovotn@redhat.com> In-Reply-To: <5bb1efba7d5e7913c8641db9d9acc3ed80e03ed7.1355928222.git.minovotn@redhat.com> References: <5bb1efba7d5e7913c8641db9d9acc3ed80e03ed7.1355928222.git.minovotn@redhat.com> From: Zhang Shengju Date: Tue, 18 Dec 2012 09:49:18 -0500 Subject: [PATCH 6/6] 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 Signed-off-by: Kevin Wolf (cherry picked from commit c088b691363070d151f80cc1fde4b7c151bdfe8f) Signed-off-by: Jeff Cody Signed-off-by: Michal Novotny --- block/vpc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/vpc.c b/block/vpc.c index 852860d..4dfacfd 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -171,6 +171,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) -- 1.7.11.7