[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/19] vmdk: fix return values of vmdk_parent_open
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 13/19] vmdk: fix return values of vmdk_parent_open |
Date: |
Fri, 21 Oct 2011 19:19:10 +0200 |
From: Paolo Bonzini <address@hidden>
While vmdk_open_desc_file (touched by the patch) correctly changed -1
to -EINVAL, vmdk_open did not. Fix it directly in vmdk_parent_open.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vmdk.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 5d16ec4..ea00938 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -283,10 +283,12 @@ static int vmdk_parent_open(BlockDriverState *bs)
char *p_name;
char desc[DESC_SIZE + 1];
BDRVVmdkState *s = bs->opaque;
+ int ret;
desc[DESC_SIZE] = '\0';
- if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {
- return -1;
+ ret = bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE);
+ if (ret < 0) {
+ return ret;
}
p_name = strstr(desc, "parentFileNameHint");
@@ -296,10 +298,10 @@ static int vmdk_parent_open(BlockDriverState *bs)
p_name += sizeof("parentFileNameHint") + 1;
end_name = strchr(p_name, '\"');
if (end_name == NULL) {
- return -1;
+ return -EINVAL;
}
if ((end_name - p_name) > sizeof(bs->backing_file) - 1) {
- return -1;
+ return -EINVAL;
}
pstrcpy(bs->backing_file, end_name - p_name + 1, p_name);
@@ -629,9 +631,10 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int
flags,
}
/* try to open parent images, if exist */
- if (vmdk_parent_open(bs)) {
+ ret = vmdk_parent_open(bs);
+ if (ret) {
vmdk_free_extents(bs);
- return -EINVAL;
+ return ret;
}
s->parent_cid = vmdk_read_cid(bs, 1);
return 0;
--
1.7.6.4
- [Qemu-devel] [PATCH 08/19] block: add bdrv_co_discard and bdrv_aio_discard support, (continued)
- [Qemu-devel] [PATCH 08/19] block: add bdrv_co_discard and bdrv_aio_discard support, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 06/19] block: unify flush implementations, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 10/19] qemu-img: Don't allow preallocation and compression at the same time, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 09/19] fdc: Fix floppy port I/O, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 11/19] qcow2: Fix bdrv_write_compressed error handling, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 07/19] block: drop redundant bdrv_flush implementation, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 12/19] pc: Fix floppy drives with if=none, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 17/19] block: take lock around bdrv_write implementations, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 14/19] vmdk: clean up open, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 16/19] block: take lock around bdrv_read implementations, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 13/19] vmdk: fix return values of vmdk_parent_open,
Kevin Wolf <=
- [Qemu-devel] [PATCH 18/19] block: change flush to co_flush, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 15/19] block: add a CoMutex to synchronous read drivers, Kevin Wolf, 2011/10/21
- [Qemu-devel] [PATCH 19/19] block: change discard to co_discard, Kevin Wolf, 2011/10/21
- Re: [Qemu-devel] [PULL 00/19] Block patches, Anthony Liguori, 2011/10/24