SHA256
1
0
forked from pool/qemu
qemu/0035-Legacy-Patch-kvm-qemu-preXX-dictzip.patch
Alexander Graf 91a548c8b1 - Cherry pick patches from qemu-kvm into the qemu package:
- 0033-Add-support-for-DictZip-enabled-gzi.patch
   - 0034-Add-tar-container-format.patch.patch
   - 0035-Legacy-Patch-kvm-qemu-preXX-dictzip.patch
   - 0036-Legacy-Patch-kvm-qemu-preXX-report-.patch
   - 0037-console-add-question-mark-escape-op.patch
   - 0038-Make-char-muxer-more-robust-wrt-sma.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=124
2012-12-13 10:49:19 +00:00

57 lines
1.7 KiB
Diff

From bd6cf9e4804b30c8212fe83ca3f08b12ab4f2d80 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 12 Dec 2012 19:11:30 +0100
Subject: [PATCH] Legacy Patch kvm-qemu-preXX-dictzip3.patch
---
block/tar.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/block/tar.c b/block/tar.c
index 27750c7..c5b75aa 100644
--- a/block/tar.c
+++ b/block/tar.c
@@ -83,7 +83,8 @@ static int str_ends(char *str, const char *end)
return !strncmp(str + str_len - end_len, end, end_len);
}
-static int is_target_file(BlockDriverState *bs, char *filename)
+static int is_target_file(BlockDriverState *bs, char *filename,
+ char *header)
{
int retval = 0;
@@ -99,10 +100,17 @@ static int is_target_file(BlockDriverState *bs, char *filename)
if (str_ends(filename, ".vmdk"))
retval = 1;
+ if (retval &&
+ (header[OFFS_TYPE] != '0') &&
+ (header[OFFS_TYPE] != 'S')) {
+ retval = 0;
+ }
+
dprintf("does filename %s match? %s\n", filename, retval ? "yes" : "no");
/* make sure we're not using this name again */
filename[0] = '\0';
+
return retval;
}
@@ -201,12 +209,13 @@ static int tar_open(BlockDriverState *bs, const char *filename, int flags)
bdrv_pread(s->hd, header_offs - s->file_len, s->longfile,
sizeof(s->longfile));
s->longfile[sizeof(s->longfile)-1] = '\0';
+ real_file = header;
} else if (s->longfile[0]) {
real_file = s->longfile;
} else {
real_file = header;
}
- } while(!is_target_file(bs, real_file));
+ } while(!is_target_file(bs, real_file, header));
/* We found an image! */