diff options
author | Anand Avati <avati@redhat.com> | 2013-04-22 21:34:05 -0700 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-06-08 14:38:53 -0700 |
commit | 1e2211d47c9fae3eb8dcb32aa7f170ba9d104134 (patch) | |
tree | 4fe95c375004d9d6915a5c739f8268c77abb224f | |
parent | f44ada6cd9bcc5ab98ca66bedde4fe23dd1c3f05 (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.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c index 8b654e4db..17cf19d0f 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; |