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.
Differential Revision: https://reviews.freebsd.org/D42278

Details

Provenance
kevansAuthored on Dec 18 2023, 5:53 AM
Reviewer
bapt
Differential Revision
D42278: calendar: correct the search order for files
Parents
rG7aa375dcc61e: libc: correct some memory leaks in acl_to_text(3) and acl_to_text_np(3)
Branches
Unknown
Tags
Unknown