From 781f5902b7bbb91811f1f810f8a419607ed36294 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 25 Jul 2015 20:14:34 -0400 Subject: Recover from errors in diropen(). Fixes #4. --- bftw.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'bftw.h') diff --git a/bftw.h b/bftw.h index 37e1524..45cc0c3 100644 --- a/bftw.h +++ b/bftw.h @@ -9,6 +9,9 @@ * the COPYING file or http://www.wtfpl.net/ for more details. * *********************************************************************/ +#ifndef BFS_BFTW_H +#define BFS_BFTW_H + #include /** @@ -23,6 +26,8 @@ struct BFTW { int base; /** The depth of this file in the walk. */ int level; + /** The errno that occurred, if typeflag == BFTW_ERROR. */ + int error; }; /** @@ -69,6 +74,8 @@ int bftw(const char *dirpath, bftw_fn *fn, int nopenfd, int flags, void *ptr); #define BFTW_SL 2 /** typeflag: Unknown type. */ #define BFTW_UNKNOWN 3 +/** typeflag: An error occurred for this file. */ +#define BFTW_ERROR 4 /** action: Keep walking. */ #define BFTW_CONTINUE 0 @@ -80,4 +87,8 @@ int bftw(const char *dirpath, bftw_fn *fn, int nopenfd, int flags, void *ptr); #define BFTW_STOP 3 /** flag: stat() each encountered file. */ -#define BFTW_STAT (1 << 0) +#define BFTW_STAT (1 << 0) +/** flag: Attempt to recover from encountered errors. */ +#define BFTW_RECOVER (1 << 1) + +#endif // BFS_BFTW_H -- cgit v1.2.3