diff options
author | Raghavendra Talur <rtalur@redhat.com> | 2013-07-16 15:58:03 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-07-16 15:58:48 -0700 |
commit | da50f61174dad89699da40212746b398b576ca15 (patch) | |
tree | 4addaef6c03dc387d6facc0dd993134439227f99 /api/src/glfs-fops.c | |
parent | 3e1d8e1689c47d8b83343a403e7d09c018472155 (diff) |
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>
Diffstat (limited to 'api/src/glfs-fops.c')
-rw-r--r-- | api/src/glfs-fops.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index fee97abda1d..61b07e9878d 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 */ |