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 <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/5333 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
3e1d8e1689
commit
da50f61174
@ -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 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user