aboutsummaryrefslogtreecommitdiff
path: root/block-vmdk.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-08-25 20:50:14 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-08-25 20:50:14 +0000
commit7143c62c953628ced7c70715f67921ed6f13dfca (patch)
tree2a72e5d7af12e5e03f17a273964004e868c8f255 /block-vmdk.c
parent4e8b5da233d453e60753a3c6326c807c73886c26 (diff)
vmdk 3 fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1052 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-vmdk.c')
-rw-r--r--block-vmdk.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block-vmdk.c b/block-vmdk.c
index 36653fb2ff..7193f959a3 100644
--- a/block-vmdk.c
+++ b/block-vmdk.c
@@ -101,8 +101,7 @@ static int vmdk_open(BlockDriverState *bs, const char *filename)
return -1;
if (read(fd, &magic, sizeof(magic)) != sizeof(magic))
goto fail;
- magic = le32_to_cpu(magic);
-
+ magic = be32_to_cpu(magic);
if (magic == VMDK3_MAGIC) {
VMDK3Header header;
if (read(fd, &header, sizeof(header)) !=
@@ -136,7 +135,9 @@ static int vmdk_open(BlockDriverState *bs, const char *filename)
s->l1_table = qemu_malloc(l1_size);
if (!s->l1_table)
goto fail;
- if (read(s->fd, s->l1_table, l1_size) != l1_size)
+ if (lseek(fd, s->l1_table_offset, SEEK_SET) == -1)
+ goto fail;
+ if (read(fd, s->l1_table, l1_size) != l1_size)
goto fail;
for(i = 0; i < s->l1_size; i++) {
le32_to_cpus(&s->l1_table[i]);