diff options
author | tmm <tmm@FreeBSD.org> | 2003-06-12 11:36:54 +0000 |
---|---|---|
committer | tmm <tmm@FreeBSD.org> | 2003-06-12 11:36:54 +0000 |
commit | d8249cec9108e9a7b3fb23e7d8c48578beba3a91 (patch) | |
tree | 4e09f271c21818a6a4ff714fd28221a9cf3454e0 /usr.sbin | |
parent | 69d791a08149931a112d07e5b9e499b93cff0549 (diff) | |
download | FreeBSD-src-d8249cec9108e9a7b3fb23e7d8c48578beba3a91.zip FreeBSD-src-d8249cec9108e9a7b3fb23e7d8c48578beba3a91.tar.gz |
Check the return values of opendir() and unlink() in cleanheaders().
If unlink() fails, just print a warning for now.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/config/main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 9e9848c..6e6ea70 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -428,7 +428,8 @@ cleanheaders(char *p) * Scan the build directory and clean out stuff that looks like * it might have been a leftover NFOO header, etc. */ - dirp = opendir(p); + if ((dirp = opendir(p)) == NULL) + err(EX_OSERR, "opendir %s", p); while ((dp = readdir(dirp)) != NULL) { i = dp->d_namlen - 2; /* Skip non-headers */ @@ -447,7 +448,8 @@ cleanheaders(char *p) if (hl) continue; printf("Removing stale header: %s\n", dp->d_name); - unlink(path(dp->d_name)); + if (unlink(path(dp->d_name)) == -1) + warn("unlink %s", dp->d_name); } (void)closedir(dirp); } |