diff options
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index e2c2f10b891..a5b3c414229 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; |