git: 9460df357344 - stable/14 - fts(3): be less strict when automount does its job under us walking autofs mount
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Mar 2025 04:20:46 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=9460df357344a2848f9cab07a5228cd9615800e1
commit 9460df357344a2848f9cab07a5228cd9615800e1
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-02-21 13:07:43 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-03-04 04:19:08 +0000
fts(3): be less strict when automount does its job under us walking autofs mount
PR: 284914
(cherry picked from commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf)
---
lib/libc/gen/fts.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index ff51d2b224c2..a718c4e1e85c 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1145,6 +1145,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
{
int ret, oerrno, newfd;
struct stat sb;
+ struct statfs sf;
newfd = fd;
if (ISSET(FTS_NOCHDIR))
@@ -1157,9 +1158,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
goto bail;
}
if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
- errno = ENOENT; /* disinformation */
- ret = -1;
- goto bail;
+ if (_fstatfs(newfd, &sf) != 0 ||
+ (sf.f_flags & MNT_AUTOMOUNTED) == 0) {
+ errno = ENOENT; /* disinformation */
+ ret = -1;
+ goto bail;
+ }
+ /* autofs might did the mount under us, accept. */
+ p->fts_dev = sb.st_dev;
+ p->fts_ino == sb.st_ino;
}
ret = fchdir(newfd);
bail: