summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-04-22 21:34:05 -0700
committerVijay Bellur <vbellur@redhat.com>2013-04-23 05:33:46 -0700
commitfdde66da060fefcbdec664b6420658936f18b345 (patch)
treecfd2ff37eb6524536646fe15a4c915783c9d2978 /api
parent86acc0f6176954fd687354d093e894636e5d6a73 (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/4872 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api')
-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;