From fd2e7d9ebb94ccf5faf5c9d9891978e09fce0b05 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 6 May 2009 05:40:15 -0700 Subject: symlink-cache: fix return value of readlink - sc_readlink wrongly returned strlen (link) + 1 when link was present in cache. - this fixes rt #828. Since fuse_readlink_cbk does link[op_ret] = '\0', there was a memory corruption. Signed-off-by: Anand V. Avati --- xlators/performance/symlink-cache/src/symlink-cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators') diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index ef05defa0af..ad0836c5eb2 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -91,7 +91,7 @@ sc_cache_update (xlator_t *this, inode_t *inode, const char *link) int sc_cache_set (xlator_t *this, inode_t *inode, struct stat *buf, - const char *link) + const char *link) { struct symlink_cache *sc = NULL; int ret = -1; @@ -268,7 +268,7 @@ sc_readlink (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_DEBUG, "cache hit %s -> %s", loc->path, link); - STACK_UNWIND (frame, strlen (link) + 1, 0, link); + STACK_UNWIND (frame, strlen (link), 0, link); FREE (link); return 0; } -- cgit