diff options
author | edwin <edwin@FreeBSD.org> | 2010-06-05 11:06:56 +0000 |
---|---|---|
committer | edwin <edwin@FreeBSD.org> | 2010-06-05 11:06:56 +0000 |
commit | 81217ca03a6fc1439145e101cc896eff085a3549 (patch) | |
tree | 18d18d7f2adc0614b86634c930d574601cbdcc25 /usr.bin | |
parent | ae16fdcca7c7898a2285373c4a1e0f957c58e581 (diff) | |
download | FreeBSD-src-81217ca03a6fc1439145e101cc896eff085a3549.zip FreeBSD-src-81217ca03a6fc1439145e101cc896eff085a3549.tar.gz |
Properly check the return value of chdir, even if it is a "this
should not happen" case.
Found with: Coverity Prevent(tm)
CID: 4932
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/calendar/io.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index f1ba1ae..2b1a26f 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -226,7 +226,8 @@ opencal(void) char *home = getenv("HOME"); if (home == NULL || *home == '\0') errx(1, "cannot get home directory"); - chdir(home); + if (chdir(home) != 0) + errx(1, "cannot enter home directory"); for (found = i = 0; i < sizeof(calendarHomes) / sizeof(calendarHomes[0]); i++) if (chdir(calendarHomes[i]) == 0 && |