File kvm-qemu-preXX-dictzip4.patch of Package kvm

From b8f1a7842100d00718fb74e19b84adbe8c1f5d6e Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 12 Jan 2010 00:24:24 +0100
Subject: [PATCH] TAR: Support files with size > 8GB

When a file in tar is bigger than 8GB, tar uses big endian binary encoding
instead of the normal ascii octal encoding.

While I implemented this mechanism, I screwed up and thought it was a 64-bit
big-endian value. I was wrong. It's a 96-bit big endian value.

Since I doubt we'll get files that are bigger than 2TB anytime soon, let's
just only read the last 64 bits of the value.

Fixes running tar files with image files > 8GB.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 block/tar.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/block/tar.c b/block/tar.c
index e143dad..d663c53 100644
--- a/block/tar.c
+++ b/block/tar.c
@@ -108,14 +108,17 @@ static uint64_t tar2u64(char *ptr)
     char oldend = ptr[12];
 
     ptr[12] = '\0';
-    if (*ptr & 0x80)
-        retval = be64_to_cpu(*(uint64_t *)ptr);
-    else
+    if (*ptr & 0x80) {
+        /* XXX we only support files up to 64 bit length */
+        retval = be64_to_cpu(*(uint64_t *)(ptr+4));
+        dprintf("Convert %lx -> %#lx\n", *(uint64_t*)(ptr+4), retval);
+    } else {
         retval = strtol(ptr, NULL, 8);
+        dprintf("Convert %s -> %#lx\n", ptr, retval);
+    }
 
     ptr[12] = oldend;
 
-    dprintf("Convert %s -> %#lx\n", ptr, retval);
     return retval;
 }
 
-- 
1.6.0.2

openSUSE Build Service is sponsored by