diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-07-04 15:37:54 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-07-10 17:29:12 -0400 |
commit | 739317470873422c1023eab22c570c374a10f498 (patch) | |
tree | d695086d44f34a0bf121613b0176216c17e9160c /src/dir.c | |
parent | 222ac5ba4fbab0ab880e36423d0f1338e39b02c7 (diff) | |
download | bfs-739317470873422c1023eab22c570c374a10f498.tar.xz |
bftw: Try to close files asynchronously
Diffstat (limited to 'src/dir.c')
-rw-r--r-- | src/dir.c | 20 |
1 files changed, 3 insertions, 17 deletions
@@ -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 |