diff options
| author | Jitendra Bhati <bhatijitendra2022@gmail.com> | 2026-06-12 17:07:55 +0000 |
|---|---|---|
| committer | Alan Somers <asomers@FreeBSD.org> | 2026-08-03 19:12:28 +0000 |
| commit | 4bd01d6ae01632501b63438b8d9a401db9744a78 (patch) | |
| tree | e896c1844fa0fa5897efc4e591ebe02f59a64e61 /include/fts.h | |
| parent | 9590878fca68e62c63d607da73139698e204d0f0 (diff) | |
fts: refactor to use fd-relative operations internally
Replace all _open() calls with _openat() in __fts_open(), fts_read(),
and fts_children(). Replace statfs() with _fstatfs().
Add fts_dirfd to struct _ftsent, set to the file descriptor of the
parent directory. Callers can use openat(ent->fts_dirfd, ent->fts_name,
...) to access files safely without relying on fts_accpath, which
enables programs in capability mode to open the files described by
_ftsent.
This is a preparatory change for fts_openat() which will allow callers
to provide a pre-opened directory fd, enabling fts(3) traversal inside
Capsicum capability mode.
Mirror all fts_open() changes to fts_open_b().
As a result of expanding _ftsend, publish new ELF symbol versions for
fts_openat and related functions.
Sponsored by: Google LLC (GSoC 2026)
Reviewed by: asomers
Pull Request: https://github.com/freebsd/freebsd-src/pull/2303
Diffstat (limited to 'include/fts.h')
| -rw-r--r-- | include/fts.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/fts.h b/include/fts.h index 479905bda463..0308b8ff880b 100644 --- a/include/fts.h +++ b/include/fts.h @@ -92,6 +92,8 @@ struct _ftsent { char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ + int fts_dirfd; /* fd for parent directory */ + int __fts_reserved[3]; /* reserved for future use */ __size_t fts_pathlen; /* strlen(fts_path) */ __size_t fts_namelen; /* strlen(fts_name) */ |
