From: Jos Collin Date: Wed, 22 Nov 2017 11:50:58 +0000 (+0530) Subject: pybind: return error message when ceph_mds_command() returns error X-Git-Tag: v12.2.3~229^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F19505%2Fhead;p=ceph.git pybind: return error message when ceph_mds_command() returns error Returned the error message when ceph_mds_command() returns error. Signed-off-by: Jos Collin (cherry picked from commit 941b58c968f6b0e359f279c8bc9e7decf51e75d1) --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index 806e0ab4c375..3f106c4dfc6a 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -962,10 +962,10 @@ cdef class LibCephFS(object): char *_inbuf = input_data size_t _inbuf_len = len(input_data) - char *_outbuf - size_t _outbuf_len - char *_outs - size_t _outs_len + char *_outbuf = NULL + size_t _outbuf_len = 0 + char *_outs = NULL + size_t _outs_len = 0 try: with nogil: @@ -974,15 +974,12 @@ cdef class LibCephFS(object): _inbuf, _inbuf_len, &_outbuf, &_outbuf_len, &_outs, &_outs_len) - if ret == 0: - my_outs = decode_cstr(_outs[:_outs_len]) - my_outbuf = _outbuf[:_outbuf_len] - if _outs_len: - ceph_buffer_free(_outs) - if _outbuf_len: - ceph_buffer_free(_outbuf) - return (ret, my_outbuf, my_outs) - else: - return (ret, b"", "") + my_outs = decode_cstr(_outs[:_outs_len]) + my_outbuf = _outbuf[:_outbuf_len] + if _outs_len: + ceph_buffer_free(_outs) + if _outbuf_len: + ceph_buffer_free(_outbuf) + return (ret, my_outbuf, my_outs) finally: free(_cmd)