diff options
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r-- | usr.bin/calendar/io.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index e5a0a08..49bfa53 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -337,7 +337,10 @@ opencal(void) if (!freopen(calendarFile, "r", stdin)) return (NULL); } else { - chdir(getenv("HOME")); + char *home = getenv("HOME"); + if (home == NULL || *home == '\0') + errx(1, "cannot get home directory"); + chdir(home); for (found = i = 0; i < sizeof(calendarHomes) / sizeof(calendarHomes[0]); i++) if (chdir(calendarHomes[i]) == 0 && |