summaryrefslogtreecommitdiffstats
path: root/gluster/gfapi.py
diff options
context:
space:
mode:
Diffstat (limited to 'gluster/gfapi.py')
-rwxr-xr-xgluster/gfapi.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gluster/gfapi.py b/gluster/gfapi.py
index 96088ff..bd6f240 100755
--- a/gluster/gfapi.py
+++ b/gluster/gfapi.py
@@ -319,7 +319,10 @@ class File(object):
rbuf = ctypes.create_string_buffer(size)
ret = api.glfs_read(self.fd, rbuf, size, 0)
if ret > 0:
- return rbuf
+ # In python 2.x, read() always returns a string. It's really upto
+ # the consumer to decode this string into whatever encoding it was
+ # written with.
+ return rbuf.value[:ret]
elif ret < 0:
err = ctypes.get_errno()
raise OSError(err, os.strerror(err))