[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] virsh-volume: Add missing check when calling virStreamNew



2013/9/28 Martin Kletzander <mkletzan redhat com>:
> On Thu, Sep 26, 2013 at 10:59:04AM +0800, Hongwei Bi wrote:
>> Check return value of virStreamNew when called by
>> cmdVolUpload and cmdVolDownload.
>>
>>
>> ---
>>  tools/virsh-volume.c |    8 ++++++--
>>  1 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
>> index 7dab532..e8b0d9a 100644
>> --- a/tools/virsh-volume.c
>> +++ b/tools/virsh-volume.c
>> @@ -665,7 +665,9 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd)
>>          goto cleanup;
>>      }
>>
>> -    st = virStreamNew(ctl->conn, 0);
>> +    if (!(st = virStreamNew(ctl->conn, 0)))
>> +        goto cleanup;
>> +
>
> Add a vshError() call before the 'goto'.
>
>>      if (virStorageVolUpload(vol, st, offset, length, 0) < 0) {
>>          vshError(ctl, _("cannot upload to volume %s"), name);
>>          goto cleanup;
>> @@ -775,7 +777,9 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd)
>>          created = true;
>>      }
>>
>> -    st = virStreamNew(ctl->conn, 0);
>> +    if (!(st = virStreamNew(ctl->conn, 0)))
>> +        goto cleanup;
>> +
>
> ditto
>
>>      if (virStorageVolDownload(vol, st, offset, length, 0) < 0) {
>>          vshError(ctl, _("cannot download from volume %s"), name);
>>          goto cleanup;
>> --
>
> ACK with that fixed,
>
> Martin

The v2 of the patch has been post.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]