From 72eda6a45b52e98458e4efa3e9819a8a3a25faef Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 28 Feb 2012 09:27:32 +0530 Subject: libglusterfs: Handle loc_copy for nameless loc BUG: 787671 Change-Id: I7601f482ae753ead83be16d1df33c2187e76dc5c Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2825 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/xlator.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index ec20029591e..bbd6df683a2 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -570,25 +570,21 @@ loc_copy (loc_t *dst, loc_t *src) if (src->parent) dst->parent = inode_ref (src->parent); - if (src->path) + if (src->path) { dst->path = gf_strdup (src->path); - if (!dst->path) - goto out; + if (!dst->path) + goto out; - dst->name = strrchr (dst->path, '/'); - if (dst->name) - dst->name++; + dst->name = strrchr (dst->path, '/'); + if (dst->name) + dst->name++; + } ret = 0; out: - if (ret == -1) { - if (dst->inode) - inode_unref (dst->inode); - - if (dst->parent) - inode_unref (dst->parent); - } + if (ret == -1) + loc_wipe (dst); err: return ret; -- cgit