summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Pierre André <jpandre@users.sourceforge.net>2012-08-22 10:00:22 +0200
committerJean-Pierre André <jpandre@users.sourceforge.net>2012-08-22 10:00:22 +0200
commit277542a4f55599ded251d987834c11bec69a2f60 (patch)
treedb923c365804b2476aa6352814bd1e80474d4208
parentdefb1f978817d15e052fed06bfc376503e1d0011 (diff)
downloadillumos-fusefs-277542a4f55599ded251d987834c11bec69a2f60.tar.gz
Fixed the error returned when renaming "." or ".."
-rw-r--r--kernel/fuse_vnops.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/kernel/fuse_vnops.c b/kernel/fuse_vnops.c
index 8275436..a7e4885 100644
--- a/kernel/fuse_vnops.c
+++ b/kernel/fuse_vnops.c
@@ -2784,6 +2784,18 @@ fuse_rename(vnode_t *sdvp, char *oldname, vnode_t *tdvp, char *newname,
struct vnode *svp = NULL;
struct vnode *tvp = NULL;
+ /*
+ * Check for renaming to or from '.' or '..'
+ */
+ if ((oldname[0] == '.' &&
+ (oldname[1] == '\0' || (oldname[1] == '.' &&
+ oldname[2] == '\0'))) ||
+ (newname[0] == '.' &&
+ (newname[1] == '\0' || (newname[1] == '.' &&
+ newname[2] == '\0')))) {
+ err = EINVAL;
+ goto errout;
+ }
/* Try obtaining the source vnode by doing a lookup */
err = fuse_lookup_i(sdvp, oldname, &svp, credp);
@@ -2801,16 +2813,7 @@ fuse_rename(vnode_t *sdvp, char *oldname, vnode_t *tdvp, char *newname,
goto errout;
}
- /*
- * Check for renaming to or from '.' or '..'
- */
- if ((oldname[0] == '.' &&
- (oldname[1] == '\0' || (oldname[1] == '.' &&
- oldname[2] == '\0'))) ||
- (newname[0] == '.' &&
- (newname[1] == '\0' || (newname[1] == '.' &&
- newname[2] == '\0'))) ||
- (sdvp == svp)) {
+ if (sdvp == svp) {
err = EINVAL;
goto errout;
}