summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-01-12 17:47:25 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-01-14 23:23:45 -0800
commitda09bf7fafa725db7f6e778f7fb5645276978948 (patch)
treeee1212867d3ae5269df72eee55570ff3030752a6
parenta1965b73da712644d1536d0dac3212041de5eb0c (diff)
libglusterfsclient/readv: fix data corruption.
- libgf_client_readv should return the total number of bytes read by multiple invocations of libgf_client_iobuf_readv, instead of return value of last invocation. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 531 (accessing a file through apache results in Permission denied errors.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=531
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 0e12d81ad..fc7dfe554 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -3857,7 +3857,7 @@ libgf_client_readv (libglusterfs_client_ctx_t *ctx, fd_t *fd,
const struct iovec *dst_vector, int dst_count, off_t offset)
{
int32_t op_ret = -1;
- size_t size = 0, tmp = 0;
+ size_t size = 0, tmp = 0, ret = 0;
int i = 0;
int dst_idx = 0;
off_t dst_offset = 0;
@@ -3878,9 +3878,10 @@ libgf_client_readv (libglusterfs_client_ctx_t *ctx, fd_t *fd,
offset += op_ret;
size -= op_ret;
+ ret += op_ret;
}
- return op_ret;
+ return ret;
}