Commit 7143c62c953628ced7c70715f67921ed6f13dfca

Authored by bellard
1 parent 4e8b5da2

vmdk 3 fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1052 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 3 deletions
block-vmdk.c
... ... @@ -101,8 +101,7 @@ static int vmdk_open(BlockDriverState *bs, const char *filename)
101 101 return -1;
102 102 if (read(fd, &magic, sizeof(magic)) != sizeof(magic))
103 103 goto fail;
104   - magic = le32_to_cpu(magic);
105   -
  104 + magic = be32_to_cpu(magic);
106 105 if (magic == VMDK3_MAGIC) {
107 106 VMDK3Header header;
108 107 if (read(fd, &header, sizeof(header)) !=
... ... @@ -136,7 +135,9 @@ static int vmdk_open(BlockDriverState *bs, const char *filename)
136 135 s->l1_table = qemu_malloc(l1_size);
137 136 if (!s->l1_table)
138 137 goto fail;
139   - if (read(s->fd, s->l1_table, l1_size) != l1_size)
  138 + if (lseek(fd, s->l1_table_offset, SEEK_SET) == -1)
  139 + goto fail;
  140 + if (read(fd, s->l1_table, l1_size) != l1_size)
140 141 goto fail;
141 142 for(i = 0; i < s->l1_size; i++) {
142 143 le32_to_cpus(&s->l1_table[i]);
... ...