diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-12-26 20:59:24 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-12-26 20:59:24 +0000 |
commit | c142be984edea72b334994c3ea4dc5e6f2384bd9 (patch) | |
tree | 49a02101adc81fe23e320156d862542bae566f32 | |
parent | 6d4de8f423ba78b283301b8f5813d9a78fa4b2e7 (diff) |
fts_read returning NULL and errno set is an error. ok ray@
-rw-r--r-- | bin/pax/ftree.c | 6 | ||||
-rw-r--r-- | sbin/dump/traverse.c | 8 | ||||
-rw-r--r-- | usr.bin/find/find.c | 9 | ||||
-rw-r--r-- | usr.bin/grep/util.c | 4 |
4 files changed, 19 insertions, 8 deletions
diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c index ad5e11baef6..d32f134b6af 100644 --- a/bin/pax/ftree.c +++ b/bin/pax/ftree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftree.c,v 1.26 2005/04/21 21:47:18 beck Exp $ */ +/* $OpenBSD: ftree.c,v 1.27 2006/12/26 20:58:25 otto Exp $ */ /* $NetBSD: ftree.c,v 1.4 1995/03/21 09:07:21 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94"; #else -static const char rcsid[] = "$OpenBSD: ftree.c,v 1.26 2005/04/21 21:47:18 beck Exp $"; +static const char rcsid[] = "$OpenBSD: ftree.c,v 1.27 2006/12/26 20:58:25 otto Exp $"; #endif #endif /* not lint */ @@ -355,6 +355,8 @@ next_file(ARCHD *arcn) */ for (;;) { if ((ftent = fts_read(ftsp)) == NULL) { + if (errno) + syswarn(1, errno, "next_file"); /* * out of files in this tree, go to next arg, if none * we are done diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index 6abec7820ef..bb045875d3a 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traverse.c,v 1.16 2006/04/02 00:48:35 deraadt Exp $ */ +/* $OpenBSD: traverse.c,v 1.17 2006/12/26 20:57:54 otto Exp $ */ /* $NetBSD: traverse.c,v 1.17 1997/06/05 11:13:27 lukem Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)traverse.c 8.2 (Berkeley) 9/23/93"; #else -static const char rcsid[] = "$OpenBSD: traverse.c,v 1.16 2006/04/02 00:48:35 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: traverse.c,v 1.17 2006/12/26 20:57:54 otto Exp $"; #endif #endif /* not lint */ @@ -190,6 +190,10 @@ mapfiles(ino_t maxino, off_t *tapesize, char *disk, char * const *dirv) mapfileino(entry->fts_statp->st_ino, tapesize, &anydirskipped); } + if (errno) { + msg("fts_read failed: %s\n", strerror(errno)); + dumpabort(0); + } (void)fts_close(dirh); /* diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c index a8547404d3b..87b4c38e7a8 100644 --- a/usr.bin/find/find.c +++ b/usr.bin/find/find.c @@ -1,4 +1,4 @@ -/* $OpenBSD: find.c,v 1.11 2004/07/20 03:50:25 deraadt Exp $ */ +/* $OpenBSD: find.c,v 1.12 2006/12/26 20:59:01 otto Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -34,7 +34,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)find.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: find.c,v 1.11 2004/07/20 03:50:25 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: find.c,v 1.12 2006/12/26 20:59:01 otto Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -163,8 +163,11 @@ find_execute(PLAN *plan, /* search plan */ (void)sigprocmask(SIG_BLOCK, &fullset, &oset); entry = fts_read(tree); (void)sigprocmask(SIG_SETMASK, &oset, NULL); - if (entry == NULL) + if (entry == NULL) { + if (errno) + err(1, "fts_read"); break; + } switch (entry->fts_info) { case FTS_D: diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 9d997f83d44..0af93493a36 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.33 2006/11/17 02:01:29 jaredy Exp $ */ +/* $OpenBSD: util.c,v 1.34 2006/12/26 20:59:23 otto Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -86,6 +86,8 @@ grep_tree(char **argv) break; } } + if (errno) + err(2, "fts_read"); return c; } |