CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2026/05/09 13:02:53
Modified files:
usr.bin/mandoc : main.c
Log message:
The regression fix in rev. 1.271 was still incomplete.
While the fchdir(2) in main() is indeed needed such that the mparse_open()
in process_onefile() finds local files, there is a second, smaller
issue purely inside check_xr(): As the ultimate fallback, fs_search()
looks for cross-referenced manual pages in the current directory,
which is typically used for working on software under development
that is not yet installed. Consequently, a second fchdir(2) is needed
inside check_xr() between mansearch(), which typically changes directory,
and the subsequent fs_search().
This makes sure that "mandoc -T lint" on a manual page that contains
an .Xr link to another manual page that is not installed but present
in the current directory does not complain about that link.
Again reported by anton@.
The fix is slightly awkward because the directory file descriptor
needs to be passed down through multiple layer of subroutines, but i
fear that cannot be helped because it is needed both in the main program
and in the low-level function check_xr().