From: Mohammad Salehe Date: Sun, 25 May 2014 06:12:11 +0000 (+0430) Subject: pybind: Fix aio_read handling of string buffer X-Git-Tag: v0.86~38^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8bda44ff37fd04a0fc9498fbbc22f0daf515d721;p=ceph.git pybind: Fix aio_read handling of string buffer Read data may contain \0, and buf.value interprerts them as string terminator. Signed-off-by: Mohammad Salehe --- diff --git a/src/pybind/rados.py b/src/pybind/rados.py index f51e744328626..93e5040873e8e 100644 --- a/src/pybind/rados.py +++ b/src/pybind/rados.py @@ -1085,8 +1085,11 @@ class Ioctx(object): :returns: completion object """ buf = create_string_buffer(length) - def oncomplete_(completion): - return oncomplete(completion, buf.value) + def oncomplete_(completion_v): + return_value = completion_v.get_return_value() + return oncomplete(completion_v, + ctypes.string_at(buf, return_value) if return_value >= 0 else None) + completion = self.__get_completion(oncomplete_, None) ret = run_in_thread(self.librados.rados_aio_read, (self.io, c_char_p(object_name),