summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2011-07-26 19:25:43 -0400
committerCole Robinson <crobinso@redhat.com>2011-07-26 19:33:36 -0400
commit4dea450820ff3616a0a4e8f14e43e48d31a75f77 (patch)
treea25e6415ae0adff0d2843807717b6d466030a20a
parent6a8c4e100eda5c11b8d3183ff4b5c6873eb58d0c (diff)
downloadlibvirt-python-split-4dea450820ff3616a0a4e8f14e43e48d31a75f77.tar.gz
libvirt-python-split-4dea450820ff3616a0a4e8f14e43e48d31a75f77.tar.xz
libvirt-python-split-4dea450820ff3616a0a4e8f14e43e48d31a75f77.zip
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.
-rw-r--r--libvirt-override.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libvirt-override.c b/libvirt-override.c
index 70e0238..bdff0e9 100644
--- a/libvirt-override.c
+++ b/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);
}