aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/du/du.c2
-rw-r--r--usr.bin/grep/util.c4
-rw-r--r--usr.bin/gzip/gzip.c4
3 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 2365e19a67e9..012e439bba34 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -268,7 +268,7 @@ main(int argc, char *argv[])
if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL)
err(1, "fts_open");
- while ((p = fts_read(fts)) != NULL) {
+ while (errno = 0, (p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
case FTS_D: /* Ignore. */
if (ignorep(p))
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index 33afe4d6b030..e517e4eaee6d 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -154,7 +154,7 @@ grep_tree(char **argv)
__DECONST(char * const *, wd) : argv, fts_flags, NULL);
if (fts == NULL)
err(2, "fts_open");
- while ((p = fts_read(fts)) != NULL) {
+ while (errno = 0, (p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
case FTS_DNR:
/* FALLTHROUGH */
@@ -187,6 +187,8 @@ grep_tree(char **argv)
break;
}
}
+ if (errno != 0)
+ err(2, "fts_read");
fts_close(fts);
return (matched);
diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c
index 47cfd225b844..5128e7ed43e0 100644
--- a/usr.bin/gzip/gzip.c
+++ b/usr.bin/gzip/gzip.c
@@ -2075,7 +2075,7 @@ handle_dir(char *dir)
return;
}
- while ((entry = fts_read(fts))) {
+ while (errno = 0, (entry = fts_read(fts))) {
switch(entry->fts_info) {
case FTS_D:
case FTS_DP:
@@ -2090,6 +2090,8 @@ handle_dir(char *dir)
handle_file(entry->fts_path, entry->fts_statp);
}
}
+ if (errno != 0)
+ warn("error with fts_read %s", dir);
(void)fts_close(fts);
}
#endif