summaryrefslogtreecommitdiffstats
path: root/bftw.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-07-25 20:14:34 -0400
committerTavian Barnes <tavianator@tavianator.com>2015-07-25 20:14:34 -0400
commit781f5902b7bbb91811f1f810f8a419607ed36294 (patch)
tree8ff1acf48ba81b2f35190a4f3d811ad1b6bf68f7 /bftw.h
parente674297be6be114a530cd06d2ca773baff1ce7cc (diff)
downloadbfs-781f5902b7bbb91811f1f810f8a419607ed36294.tar.xz
Recover from errors in diropen().
Fixes #4.
Diffstat (limited to 'bftw.h')
-rw-r--r--bftw.h13
1 files changed, 12 insertions, 1 deletions
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 <sys/stat.h>
/**
@@ -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