summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-01 05:45:03 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-08 03:23:40 -0700
commit2b334a49ae0e8b26c49fe2545a6a17c59e11cd7b (patch)
tree95a42e84c66c87e5670a83cb6a830c22f3ccb79d /libglusterfsclient/src/libglusterfsclient.c
parentc0c54cd9feeff6093c78027fade26379838e9899 (diff)
libglusterfsclient: handle intermediate path components which are symlinks properly in glusterfs_glh_realpath.
- while building the realpath, if the intermediate path happens to be a symbolic link, the content of link was being appended at dirname (path), instead of appending to intermediate path. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 237 (If any of the path component other than the last one, happens to be a symbolic link glusterfs_glh_realpath does not construct correct path.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=237
Diffstat (limited to 'libglusterfsclient/src/libglusterfsclient.c')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 58a8017d3..448a8b81e 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -6862,8 +6862,8 @@ glusterfs_glh_realpath (glusterfs_handle_t handle, const char *path,
}
ret = glusterfs_glh_readlink (handle, rpath,
- buf,
- path_max - 1);
+ buf,
+ path_max - 1);
if (ret < 0) {
gf_log ("libglusterfsclient",
GF_LOG_ERROR,
@@ -6876,7 +6876,7 @@ glusterfs_glh_realpath (glusterfs_handle_t handle, const char *path,
buf[ret] = '\0';
if (buf[0] != '/') {
- tmppath = strdup (path);
+ tmppath = strdup (rpath);
tmppath = dirname (tmppath);
sprintf (absolute_path, "%s/%s",
tmppath, buf);
@@ -6885,9 +6885,14 @@ glusterfs_glh_realpath (glusterfs_handle_t handle, const char *path,
FREE (tmppath);
}
- rpath = glusterfs_glh_realpath (handle, buf, rpath);
+ rpath = glusterfs_glh_realpath (handle, buf,
+ rpath);
FREE (buf);
- goto out;
+ if (rpath == NULL) {
+ goto out;
+ }
+ dest = rpath + strlen (rpath);
+
} else if (!S_ISDIR (stbuf.st_mode) && *end != '\0') {
errno = ENOTDIR;
goto err;