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 <avati@amp.gluster.com>
This commit is contained in:
Raghavendra G 2009-05-06 05:40:15 -07:00 committed by Anand V. Avati
parent 542d9ed6c1
commit fd2e7d9ebb

View File

@ -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;
}