From d8249cec9108e9a7b3fb23e7d8c48578beba3a91 Mon Sep 17 00:00:00 2001 From: tmm Date: Thu, 12 Jun 2003 11:36:54 +0000 Subject: Check the return values of opendir() and unlink() in cleanheaders(). If unlink() fails, just print a warning for now. --- usr.sbin/config/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usr.sbin/config/main.c') 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); } -- cgit v1.1