diff options
author | Alexander Graf <agraf@suse.de> | 2012-12-12 19:11:30 +0100 |
---|---|---|
committer | hyokeun <hyokeun.jeon@samsung.com> | 2016-09-06 15:55:34 +0900 |
commit | b1260507fe2503176154d433909f35578f0d1626 (patch) | |
tree | c749e31407a0708dcc9a769f802ce35fb16a1d19 | |
parent | 3d7d523daa959b54be0ed3b4072599e669a97a7d (diff) | |
download | qemu-b1260507fe2503176154d433909f35578f0d1626.tar.gz qemu-b1260507fe2503176154d433909f35578f0d1626.tar.bz2 qemu-b1260507fe2503176154d433909f35578f0d1626.zip |
Legacy Patch kvm-qemu-preXX-dictzip3.patch
-rw-r--r-- | block/tar.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/block/tar.c b/block/tar.c index 508265ed5..734082a01 100644 --- a/block/tar.c +++ b/block/tar.c @@ -73,7 +73,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; @@ -89,10 +90,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; } @@ -219,12 +227,13 @@ static int tar_open(BlockDriverState *bs, QDict *options, int flags, Error **err bdrv_pread(s->hd->file, 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! */ |