From da50f61174dad89699da40212746b398b576ca15 Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Tue, 16 Jul 2013 15:58:03 +0530 Subject: gfapi: fix for not able to rename folders If oldname is being renamed to newname, we need to check for type of newname only if newname exists. Change-Id: I068a283f9ffe67fcd5e8754d6bf052a2339efbf2 BUG: 953694 Signed-off-by: Raghavendra Talur Reviewed-on: http://review.gluster.org/5333 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- api/src/glfs-fops.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'api') diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index fee97abda..61b07e987 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -1526,14 +1526,17 @@ retrynew: if (ret && errno != ENOENT && newloc.parent) goto out; - if ((oldiatt.ia_type == IA_IFDIR) != (newiatt.ia_type == IA_IFDIR)) { - /* Either both old and new must be dirs, or both must be - non-dirs. Else, fail. - */ - ret = -1; - errno = EISDIR; - goto out; - } + if (newiatt.ia_type != IA_INVAL) { + if ((oldiatt.ia_type == IA_IFDIR) != + (newiatt.ia_type == IA_IFDIR)) { + /* Either both old and new must be dirs, + * or both must be non-dirs. Else, fail. + */ + ret = -1; + errno = EISDIR; + goto out; + } + } /* TODO: check if new or old is a prefix of the other, and fail EINVAL */ -- cgit