git: 0b2c159c8faa - main - msdosfs: return ENOENT if looking up invalid name for OPEN or DELETE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 25 Aug 2024 15:02:26 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=0b2c159c8faa3ca155412a1b2e57b3d6bcf91880
commit 0b2c159c8faa3ca155412a1b2e57b3d6bcf91880
Author: Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2024-08-25 14:50:53 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-08-25 14:50:53 +0000
msdosfs: return ENOENT if looking up invalid name for OPEN or DELETE
and keep reporting EINVAL for CREATE or RENAME lookups. The reasoning is
that non-corrupted filesystem cannot have invalid dirents anyway, so
returning ENOENT is more in-line with the natural behavior.
PR: 281033
MFC after: 1 week
---
sys/fs/msdosfs/msdosfs_lookup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c
index 2a90339d0878..e799a5ce05f6 100644
--- a/sys/fs/msdosfs/msdosfs_lookup.c
+++ b/sys/fs/msdosfs/msdosfs_lookup.c
@@ -198,7 +198,9 @@ msdosfs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname
switch (unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename,
cnp->cn_namelen, 0, pmp)) {
case 0:
- return (EINVAL);
+ if (nameiop == CREATE || nameiop == RENAME)
+ return (EINVAL);
+ return (ENOENT);
case 1:
break;
case 2: