summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-04-22 21:34:05 -0700
committerVijay Bellur <vbellur@redhat.com>2013-06-08 14:38:53 -0700
commit1e2211d47c9fae3eb8dcb32aa7f170ba9d104134 (patch)
tree4fe95c375004d9d6915a5c739f8268c77abb224f
parentf44ada6cd9bcc5ab98ca66bedde4fe23dd1c3f05 (diff)
gfapi: handle root (/) resolution gracefully for realpath()
Resolving path of / is crucial for realpath() to work properly. Change-Id: I8a1b482beba37f01afbd20446d9e6f6125f2ec34 BUG: 953694 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/5152 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--api/src/glfs-resolve.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 8b654e4dbff..17cf19d0fdc 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -60,7 +60,10 @@ glfs_loc_touchup (loc_t *loc)
int ret = -1;
char *bn = NULL;
- ret = inode_path (loc->parent, loc->name, &path);
+ if (loc->parent)
+ ret = inode_path (loc->parent, loc->name, &path);
+ else
+ ret = inode_path (loc->inode, 0, &path);
loc->path = path;