Re: [PATCH] python: Properly report errors if virStreamRecv fails

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

 



On 07/26/2011 07:27 PM, Eric Blake wrote:
> On 07/26/2011 05:26 PM, Cole Robinson wrote:
>> We only want to raise the special value -2. -1 should return None
>> which tells the bindings to throw an exception.
>> ---
>>   python/libvirt-override.c |    4 +++-
>>   1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/python/libvirt-override.c b/python/libvirt-override.c
>> index 70e0238..bdff0e9 100644
>> --- a/python/libvirt-override.c
>> +++ b/python/libvirt-override.c
>> @@ -4138,8 +4138,10 @@ libvirt_virStreamRecv(PyObject *self ATTRIBUTE_UNUSED,
>>       buf[ret>  -1 ? ret : 0] = '\0';
>>       DEBUG("StreamRecv ret=%d strlen=%d\n", ret, (int) strlen(buf));
>>
>> -    if (ret<  0)
>> +    if (ret == -2)
>>           return libvirt_intWrap(ret);
>> +    if (ret<  0)
>> +        return VIR_PY_NONE;
>>       return libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret);
> 
> ACK.
> 

Speedy! Pushed now.

- Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]