summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2013-06-18 11:05:10 -0700
committerDan Mick <dan.mick@inktank.com>2013-06-18 14:22:47 -0700
commit54f74325c7bdb213300564ad1ff0a62e9a706976 (patch)
tree6d4e744c0daac8473a6c104a724d64a0d3da6d32
parent81e73c7a6391ab102879e9b90a60544c2c1a7563 (diff)
downloadceph-54f74325c7bdb213300564ad1ff0a62e9a706976.tar.gz
rados.py: return error strings even if ret != 0
Key rados_free() off returned length, not ret Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/pybind/rados.py42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/pybind/rados.py b/src/pybind/rados.py
index c4000465272..90b7ffd9874 100644
--- a/src/pybind/rados.py
+++ b/src/pybind/rados.py
@@ -544,17 +544,15 @@ Rados object in state %s." % (self.state))
outbufp, byref(outbuflen), outsp, byref(outslen)),
timeout)
- if ret == 0:
- # copy returned memory (ctypes makes a copy, not a reference)
- my_outbuf = outbufp.contents[:(outbuflen.value)]
- my_outs = outsp.contents[:(outslen.value)]
+ # copy returned memory (ctypes makes a copy, not a reference)
+ my_outbuf = outbufp.contents[:(outbuflen.value)]
+ my_outs = outsp.contents[:(outslen.value)]
- # free callee's allocations
+ # free callee's allocations
+ if outbuflen.value:
run_in_thread(self.librados.rados_buffer_free, (outbufp.contents,))
+ if outslen.value:
run_in_thread(self.librados.rados_buffer_free, (outsp.contents,))
- else:
- my_outbuf = ''
- my_outs = ''
return (ret, my_outbuf, my_outs)
@@ -576,17 +574,15 @@ Rados object in state %s." % (self.state))
outbufp, byref(outbuflen), outsp, byref(outslen)),
timeout)
- if ret == 0:
- # copy returned memory
- my_outbuf = outbufp.contents[:(outbuflen.value)]
- my_outs = outsp.contents[:(outslen.value)]
+ # copy returned memory (ctypes makes a copy, not a reference)
+ my_outbuf = outbufp.contents[:(outbuflen.value)]
+ my_outs = outsp.contents[:(outslen.value)]
- # free callee's allocations
+ # free callee's allocations
+ if outbuflen.value:
run_in_thread(self.librados.rados_buffer_free, (outbufp.contents,))
+ if outslen.value:
run_in_thread(self.librados.rados_buffer_free, (outsp.contents,))
- else:
- my_outbuf = ''
- my_outs = ''
return (ret, my_outbuf, my_outs)
@@ -608,17 +604,15 @@ Rados object in state %s." % (self.state))
outbufp, byref(outbuflen), outsp, byref(outslen)),
timeout)
- if ret == 0:
- # copy returned memory
- my_outbuf = outbufp.contents[:(outbuflen.value)]
- my_outs = outsp.contents[:(outslen.value)]
+ # copy returned memory (ctypes makes a copy, not a reference)
+ my_outbuf = outbufp.contents[:(outbuflen.value)]
+ my_outs = outsp.contents[:(outslen.value)]
- # free callee's allocations
+ # free callee's allocations
+ if outbuflen.value:
run_in_thread(self.librados.rados_buffer_free, (outbufp.contents,))
+ if outslen.value:
run_in_thread(self.librados.rados_buffer_free, (outsp.contents,))
- else:
- my_outbuf = ''
- my_outs = ''
return (ret, my_outbuf, my_outs)