summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-11-14 22:40:40 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-11-14 22:40:40 -0500
commita7e08e893eb796637ca2c53cd32a529f453ace12 (patch)
tree73f6bdc3e00baab465b5b90e963af94391f6d984 /util.h
parent196cf9f617ca17acec75eafbcd9e5e7989752dcb (diff)
downloadbfs-a7e08e893eb796637ca2c53cd32a529f453ace12.tar.xz
Check for readdir() errors everywhere.
Diffstat (limited to 'util.h')
-rw-r--r--util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/util.h b/util.h
index c3b3dbe..fbcadbd 100644
--- a/util.h
+++ b/util.h
@@ -12,9 +12,15 @@
#ifndef BFS_UTIL_H
#define BFS_UTIL_H
+#include <dirent.h>
#include <stdbool.h>
/**
+ * readdir() wrapper that makes error handling cleaner.
+ */
+int xreaddir(DIR *dir, struct dirent **de);
+
+/**
* Check if a file descriptor is open.
*/
bool isopen(int fd);