summaryrefslogtreecommitdiffstats
path: root/src/dir.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-07-04 15:37:54 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-07-10 17:29:12 -0400
commit739317470873422c1023eab22c570c374a10f498 (patch)
treed695086d44f34a0bf121613b0176216c17e9160c /src/dir.c
parent222ac5ba4fbab0ab880e36423d0f1338e39b02c7 (diff)
downloadbfs-739317470873422c1023eab22c570c374a10f498.tar.xz
bftw: Try to close files asynchronously
Diffstat (limited to 'src/dir.c')
-rw-r--r--src/dir.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/dir.c b/src/dir.c
index 685bac5..0304674 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -15,10 +15,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#ifndef BFS_USE_GETDENTS
-# define BFS_USE_GETDENTS (__linux__ || __FreeBSD__)
-#endif
-
#if BFS_USE_GETDENTS
# if __linux__
# include <sys/syscall.h>
@@ -296,25 +292,15 @@ int bfs_closedir(struct bfs_dir *dir) {
return ret;
}
-int bfs_fdclosedir(struct bfs_dir *dir, bool same_fd) {
+#if BFS_USE_UNWRAPDIR
+int bfs_unwrapdir(struct bfs_dir *dir) {
#if BFS_USE_GETDENTS
int ret = dir->fd;
#elif __FreeBSD__
int ret = fdclosedir(dir->dir);
-#else
- if (same_fd) {
- errno = ENOTSUP;
- return -1;
- }
-
- int ret = dup_cloexec(dirfd(dir->dir));
- if (ret < 0) {
- return -1;
- }
-
- bfs_closedir(dir);
#endif
sanitize_uninit(dir, DIR_SIZE);
return ret;
}
+#endif