summaryrefslogtreecommitdiff
path: root/src/basic/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/util.c')
-rw-r--r--src/basic/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index e3b2af8e02..0c3ef2a68c 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -354,6 +354,17 @@ FILE* safe_fclose(FILE *f) {
return NULL;
}
+DIR* safe_closedir(DIR *d) {
+
+ if (d) {
+ PROTECT_ERRNO;
+
+ assert_se(closedir(d) >= 0 || errno != EBADF);
+ }
+
+ return NULL;
+}
+
int unlink_noerrno(const char *path) {
PROTECT_ERRNO;
int r;