From da09bf7fafa725db7f6e778f7fb5645276978948 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Tue, 12 Jan 2010 17:47:25 +0000 Subject: 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 Signed-off-by: Anand V. Avati 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 --- libglusterfsclient/src/libglusterfsclient.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 0e12d81add5..fc7dfe55451 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; } -- cgit