[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1.1 2/4] sheepdog: fix return value of do_load_s
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 1.1 2/4] sheepdog: fix return value of do_load_save_vm_state |
Date: |
Mon, 21 May 2012 17:51:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
Am 16.05.2012 20:15, schrieb MORITA Kazutaka:
> bdrv_save_vmstate and bdrv_load_vmstate should return the number of
> processed bytes on success.
>
> Signed-off-by: MORITA Kazutaka <address@hidden>
> ---
> block/sheepdog.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 776a1cc..146a221 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -1932,7 +1932,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s,
> uint8_t *data,
> int64_t pos, int size, int load)
> {
> int fd, create;
> - int ret = 0;
> + int ret = 0, done = 0;
> unsigned int data_len;
> uint64_t vmstate_oid;
> uint32_t vdi_index;
> @@ -1971,10 +1971,14 @@ static int do_load_save_vmstate(BDRVSheepdogState *s,
> uint8_t *data,
>
> pos += data_len;
> size -= data_len;
> - ret += data_len;
> + done += data_len;
> }
> cleanup:
> closesocket(fd);
> +
> + if (done)
> + return done;
Missing braces...
> +
> return ret;
> }
...but I think if an error occurred, we should not return short
reads/writes anyway, but instead return the error.
Kevin