[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 15/21] dmg: fix reading of uncompressed chunks
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 15/21] dmg: fix reading of uncompressed chunks |
Date: |
Fri, 14 May 2010 19:10:49 +0200 |
From: Christoph Hellwig <address@hidden>
When dmg_read_chunk encounters an uncompressed chunk it currently
calls read without any previous adjustment of the file postion.
This seems very wrong, and the "reference" implementation in
dmg2img does a search to the same offset as done in the various
compression cases, so do the same here.
Signed-off-by: Christoph Hellwig <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/dmg.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/block/dmg.c b/block/dmg.c
index d5c1a68..02a3d67 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -239,7 +239,8 @@ static inline int dmg_read_chunk(BDRVDMGState *s,int
sector_num)
return -1;
break; }
case 1: /* copy */
- ret = read(s->fd, s->uncompressed_chunk, s->lengths[chunk]);
+ ret = pread(s->fd, s->uncompressed_chunk, s->lengths[chunk],
+ s->offsets[chunk]);
if (ret != s->lengths[chunk])
return -1;
break;
--
1.6.6.1
- [Qemu-devel] [PATCH 04/21] cloop: use qemu block API, (continued)
- [Qemu-devel] [PATCH 04/21] cloop: use qemu block API, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 05/21] ide: Fix ide_dma_cancel, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 09/21] block: Fix protocol detection for Windows devices, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 07/21] bochs: use qemu block API, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 03/21] cloop: use pread, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 08/21] block: Avoid unchecked casts for AIOCBs, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 06/21] bochs: use pread, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 12/21] parallels: use pread, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 13/21] parallels: use qemu block API, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 11/21] block/vdi: Allow disk images of size 0, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 15/21] dmg: fix reading of uncompressed chunks,
Kevin Wolf <=
- [Qemu-devel] [PATCH 14/21] block/vpc: Fix conversion from size to disk geometry, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 02/21] qemu-nbd: Improve error reporting, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 16/21] dmg: use pread, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 17/21] dmg: use qemu block API, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 18/21] block/vdi: Fix image opening and creation for odd disk sizes, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 20/21] Fix docs for block stats monitor command, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 21/21] block: Remove special case for vvfat, Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 19/21] use qemu_free() instead of free(), Kevin Wolf, 2010/05/14
- [Qemu-devel] [PATCH 10/21] block: Fix bdrv_commit, Kevin Wolf, 2010/05/14
- [Qemu-devel] Re: [PULL 00/21] Block patches, Anthony Liguori, 2010/05/17