summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Natano <natano@cvs.openbsd.org>2016-06-01 15:44:08 +0000
committerMartin Natano <natano@cvs.openbsd.org>2016-06-01 15:44:08 +0000
commit13f9c7d6f84ae7ed01ebfe829350fef64aa4a9f3 (patch)
treef0b5d38f0eb3701534bfbbb38dfb55b7343be3c2
parentbf014e17cf18a4216e61f10169786ed944b8f90d (diff)
mkdir() on ntfs should return EROFS, not ENOENT.
issue found by landry ok kettenis millert
-rw-r--r--sys/ntfs/ntfs_subr.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/ntfs/ntfs_subr.c b/sys/ntfs/ntfs_subr.c
index 773e36d21a7..eb5eb13b2a3 100644
--- a/sys/ntfs/ntfs_subr.c
+++ b/sys/ntfs/ntfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_subr.c,v 1.45 2016/02/07 09:31:14 stefan Exp $ */
+/* $OpenBSD: ntfs_subr.c,v 1.46 2016/06/01 15:44:07 natano Exp $ */
/* $NetBSD: ntfs_subr.c,v 1.4 2003/04/10 21:37:32 jdolecek Exp $ */
/*-
@@ -1055,14 +1055,20 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp,
}
} while (1);
- /* perform full scan if no entry was found */
- if (!fullscan && error == ENOENT) {
- fullscan = 1;
- cn = 0; /* need zero, used by lookup_ctx */
+ if (error == ENOENT) {
+ /* perform full scan if no entry was found */
+ if (!fullscan) {
+ fullscan = 1;
+ cn = 0; /* need zero, used by lookup_ctx */
- DDPRINTF("ntfs_ntlookupfile: fullscan performed for: %.*s\n",
- (unsigned int)fnamelen, fname);
- goto loop;
+ DDPRINTF("ntfs_ntlookupfile: fullscan performed for: %.*s\n",
+ (unsigned int)fnamelen, fname);
+ goto loop;
+ }
+
+ if ((cnp->cn_flags & ISLASTCN) &&
+ (cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME))
+ error = EJUSTRETURN;
}
DPRINTF("finish\n");