diff options
author | Stefan Eßer <se@FreeBSD.org> | 2020-10-29 08:26:38 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 2020-10-29 08:26:38 +0000 |
commit | 3fa2a149d68d22fa32ba7b6c09773388ac490fd1 (patch) | |
tree | ae8088a6a9ed94eb596dc3cdf2e6c439fa06f7bf /usr.bin/calendar | |
parent | 9abc7621384fcbf0bb8954f9c5e2a491304a82bd (diff) | |
download | src-3fa2a149d68d22fa32ba7b6c09773388ac490fd1.tar.gz src-3fa2a149d68d22fa32ba7b6c09773388ac490fd1.zip |
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
Notes
Notes:
svn path=/head/; revision=367126
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r-- | usr.bin/calendar/calendar.c | 1 |
1 files changed, 1 insertions, 0 deletions
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); } |