mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
python: Properly report errors if virStreamRecv fails
We only want to raise the special value -2. -1 should return None which tells the bindings to throw an exception.
This commit is contained in:
parent
831c81fcd4
commit
d5f969e130
@ -4138,8 +4138,10 @@ libvirt_virStreamRecv(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
buf[ret > -1 ? ret : 0] = '\0';
|
buf[ret > -1 ? ret : 0] = '\0';
|
||||||
DEBUG("StreamRecv ret=%d strlen=%d\n", ret, (int) strlen(buf));
|
DEBUG("StreamRecv ret=%d strlen=%d\n", ret, (int) strlen(buf));
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret == -2)
|
||||||
return libvirt_intWrap(ret);
|
return libvirt_intWrap(ret);
|
||||||
|
if (ret < 0)
|
||||||
|
return VIR_PY_NONE;
|
||||||
return libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret);
|
return libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user