summaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-07-22 01:15:21 -0700
committerAnand Avati <avati@redhat.com>2013-07-31 06:23:37 -0700
commit21d032bf052957b50043f5f3775903d9d7f029c3 (patch)
tree67dcd7b391d5b281497d14553ae088c4035cdcf3 /api/src
parentac2cd684c2d8fa4a66800a6cc98f6c5c562b4b7f (diff)
gfapi: fix glfs_readlink()
glfs_readlink() is supposed to memcpy the buffer pointer returned by syncop_readlink(). Fix it. Change-Id: I5936b07abbd93cf02b354233dc60f6623e30a38b BUG: 953694 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/5439 Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'api/src')
-rw-r--r--api/src/glfs-fops.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index ebd71f08861..0e4acb76bec 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -1203,6 +1203,7 @@ glfs_readlink (struct glfs *fs, const char *path, char *buf, size_t bufsiz)
loc_t loc = {0, };
struct iatt iatt = {0, };
int reval = 0;
+ char *linkval = NULL;
__glfs_entry_fs (fs);
@@ -1226,7 +1227,11 @@ retry:
goto out;
}
- ret = syncop_readlink (subvol, &loc, &buf, bufsiz);
+ ret = syncop_readlink (subvol, &loc, &linkval, bufsiz);
+ if (ret > 0) {
+ memcpy (buf, linkval, ret);
+ GF_FREE (linkval);
+ }
ESTALE_RETRY (ret, errno, reval, &loc, retry);
out: