git: 4d1134a54c85 - stable/13 - fstatat(2): restore AT_EMPTY_PATH handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Jun 2023 08:20:29 UTC
The branch stable/13 has been updated by dchagin:
URL: https://cgit.FreeBSD.org/src/commit/?id=4d1134a54c85ae8926eb43b7e51aee6e65b71816
commit 4d1134a54c85ae8926eb43b7e51aee6e65b71816
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-05-02 15:11:39 +0000
Commit: Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-06-29 08:15:50 +0000
fstatat(2): restore AT_EMPTY_PATH handling
Fixes: cb858340dcbf214cc4c4d78dbb741620d7b3a252
Reported by: markj
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a1d71cebc05ccfeedf95f2db3e94b17270167888)
---
sys/kern/vfs_syscalls.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 89f45e898d8e..7f7836450811 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2432,8 +2432,12 @@ kern_statat(struct thread *td, int flag, int fd, const char *path,
AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH) | LOCKSHARED | LOCKLEAF |
AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights, td);
- if ((error = namei(&nd)) != 0)
+ if ((error = namei(&nd)) != 0) {
+ if (error == ENOTDIR &&
+ (nd.ni_resflags & NIRES_EMPTYPATH) != 0)
+ error = kern_fstat(td, fd, sbp);
return (error);
+ }
error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED, td);
NDFREE_NOTHING(&nd);
vput(nd.ni_vp);