summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-02 01:12:39 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-08 03:23:00 -0700
commitc7f757aea81e65980c68b4293836097ce595b5b3 (patch)
treeeff722fc48f5eb6a23fb07fc7e52c22f804fafa5 /libglusterfsclient
parent6f1a9007f4876d46bd2d67e67312c24771d82bf5 (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')
-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 e2c2f10b8..a5b3c4142 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -6856,8 +6856,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,
@@ -6870,7 +6870,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);
@@ -6879,9 +6879,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;