2017-03-15 20:38:55 +01:00
|
|
|
From a4e7e274fa2d1fab3e2a4bfa9ca379252c5aa505 Mon Sep 17 00:00:00 2001
|
2012-12-13 11:49:19 +01:00
|
|
|
From: Alexander Graf <agraf@suse.de>
|
|
|
|
Date: Wed, 12 Dec 2012 19:11:30 +0100
|
|
|
|
Subject: [PATCH] Legacy Patch kvm-qemu-preXX-dictzip3.patch
|
|
|
|
|
|
|
|
---
|
2014-01-17 23:04:30 +01:00
|
|
|
block/tar.c | 13 +++++++++++--
|
|
|
|
1 file changed, 11 insertions(+), 2 deletions(-)
|
2012-12-13 11:49:19 +01:00
|
|
|
|
|
|
|
diff --git a/block/tar.c b/block/tar.c
|
2017-03-15 20:38:55 +01:00
|
|
|
index 508265ed5e..734082a011 100644
|
2012-12-13 11:49:19 +01:00
|
|
|
--- a/block/tar.c
|
|
|
|
+++ b/block/tar.c
|
2016-04-05 15:18:15 +02:00
|
|
|
@@ -73,7 +73,8 @@ static int str_ends(char *str, const char *end)
|
2012-12-13 11:49:19 +01:00
|
|
|
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;
|
|
|
|
|
2016-04-05 15:18:15 +02:00
|
|
|
@@ -89,10 +90,17 @@ static int is_target_file(BlockDriverState *bs, char *filename)
|
2012-12-13 11:49:19 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-04-05 15:18:15 +02:00
|
|
|
@@ -219,12 +227,13 @@ static int tar_open(BlockDriverState *bs, QDict *options, int flags, Error **err
|
2016-09-19 19:06:58 +02:00
|
|
|
bdrv_pread(s->hd->file, header_offs - s->file_len, s->longfile,
|
2012-12-13 11:49:19 +01:00
|
|
|
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! */
|
|
|
|
|