Add search of LOCALBASE/share/calendar for calendars supplied by a port.

Calendar files in LOCALBASE override similarily named ones in the base
system. This could easily be changed if the base system calendars should
have precedence, but it could lead to a violation of POLA since then the
port's files were ignored unless those in base have been deleted.

There was no definition of _PATH_LOCALBASE in paths.h, but verbatim uses
of /usr/local existed for _PATH_DEFPATH. Use _PATH_LOCALBASE here to ease
a consistent modification of this prefix.

Reviewed by:	imp, pfg
Differential Revision:	https://reviews.freebsd.org/D26882
This commit is contained in:
Stefan Eßer 2020-10-23 09:22:23 +00:00
parent a71074e0af
commit 34b38e1245
3 changed files with 6 additions and 2 deletions

View File

@ -37,8 +37,11 @@
#include <sys/cdefs.h>
#define _PATH_LOCALBASE "/usr/local"
/* Default search path. */
#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:" \
_PATH_LOCALBASE "/sbin:" _PATH_LOCALBASE "/bin"
/* All standard utilities path. */
#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
/* Locate system binaries. */

View File

@ -71,7 +71,7 @@ enum {
};
const char *calendarFile = "calendar"; /* default calendar file */
static const char *calendarHomes[] = {".calendar", _PATH_INCLUDE}; /* HOME */
static const char *calendarHomes[] = {".calendar", _PATH_INCLUDE_LOCAL, _PATH_INCLUDE}; /* HOME */
static const char *calendarNoMail = "nomail";/* don't sent mail if file exist */
static char path[MAXPATHLEN];

View File

@ -35,3 +35,4 @@
#include <paths.h>
#define _PATH_INCLUDE "/usr/share/calendar"
#define _PATH_INCLUDE_LOCAL _PATH_LOCALBASE "/share/calendar"