diff options
author | Raghavendra Talur <rtalur@redhat.com> | 2013-07-16 15:58:03 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-09-10 01:24:58 -0700 |
commit | a3a704f369440d42acd0eb8d86cd07e2852980b7 (patch) | |
tree | f5f83e5cdc5cd2f59f95bf9424003b90f08779f6 /api/src | |
parent | 5159d29cf36153d874ee446805419c864c1ba1ee (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/5886
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api/src')
-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 548a4a8966b..e5143b346e6 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -1539,14 +1539,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 */ |