summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-07-22 01:15:21 -0700
committerVijay Bellur <vbellur@redhat.com>2013-09-10 01:24:37 -0700
commit5159d29cf36153d874ee446805419c864c1ba1ee (patch)
treec0c8541e6b2ee613bb1057a48ecdfb3264c4910e
parent2cd2532e149847771319ad56b8b745f0f38c0bd4 (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/5885 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-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 1794e603f..548a4a896 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -1211,6 +1211,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);
@@ -1234,7 +1235,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: