summaryrefslogtreecommitdiffstats
path: root/src/dir.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-04-11 22:06:42 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-06-12 14:39:34 -0400
commit0c10a1e984bc2bed1fe3a7dadbd94a9c24139a91 (patch)
tree43073ba63fc54b0b30e587aaf71c9e66b721c888 /src/dir.h
parente8df57b5a49a70e2daa5bb6c00b8e0e06c51306a (diff)
downloadbfs-0c10a1e984bc2bed1fe3a7dadbd94a9c24139a91.tar.xz
dir: Add a flag to bfs_freedir() to force the fd to stay the same
Diffstat (limited to 'src/dir.h')
-rw-r--r--src/dir.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dir.h b/src/dir.h
index 01eaaba..e0fe913 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -8,6 +8,7 @@
#ifndef BFS_DIR_H
#define BFS_DIR_H
+#include "config.h"
#include <sys/types.h>
/**
@@ -103,9 +104,14 @@ int bfs_closedir(struct bfs_dir *dir);
*
* @param dir
* The directory to free.
+ * @param same_fd
+ * If true, require that the returned file descriptor is the same one
+ * that bfs_dirfd() would have returned. Otherwise, it may be a new
+ * file descriptor for the same directory.
* @return
- * The file descriptor on success, or -1 on failure.
+ * On success, a file descriptor for the directory is returned. On
+ * failure, -1 is returned, and the directory remains open.
*/
-int bfs_freedir(struct bfs_dir *dir);
+int bfs_freedir(struct bfs_dir *dir, bool same_fd);
#endif // BFS_DIR_H