From 3fa2a149d68d22fa32ba7b6c09773388ac490fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Thu, 29 Oct 2020 08:26:38 +0000 Subject: [PATCH] Fix calendar -a processing of files included in the user's home directory The existing code performed a chdir() into the home directory, but the parser fell back to using the invoking user's home directory as the base directory for the search for an include file. Since use of the -a option is limited to UID==0, the directory searched was typically ~root/.calendar, not the .calendar directory of the user whose file is being processed. PR: 205580 Reported by: greg.bal4@gmail.com (Greg Balfour) MFC after: 3 days --- usr.bin/calendar/calendar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index a2d015fa791e..5f6d97ad1494 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -228,6 +228,7 @@ main(int argc, char *argv[]) if (setusercontext(lc, pw, pw->pw_uid, LOGIN_SETALL) != 0) errx(1, "setusercontext"); + setenv("HOME", pw->pw_dir, 1); cal(); exit(0); }