HomeFreeBSD

calendar: correct the search order for files

Description

calendar: correct the search order for files

Include files that don't begin with a '/' are documented to search the
current directory, then /usr/share/calendar. This hasn't been accurate
for years, since e061f95e7b9b ("Rework calendar(1) parser") rewrote a
lot of this.

Stash off the cwd before we do any chdir()ing around and use that to
honor the same order we'll follow for the -f flag. This may result in
an extra lookup that will fail for the initial calendar file, but I
don't think it's worth the complexity to avoid it.

While we're here, fix the documentation to just reference the order
described in FILES so that we only need to keep it up to date in one
place.

Reviewed by: bapt
Sponsored by: Klara, Inc.

(cherry picked from commit 0a82cd4f101c5eb8533a0049aaa3f06f005cf8af)

Details

Provenance
kevansAuthored on Dec 18 2023, 5:53 AM
Parents
rG15b946de9917: loader: lua: remove the default kernel if it doesn't exist
Branches
Unknown
Tags
Unknown