summaryrefslogtreecommitdiffstats
path: root/src/basic/recurse-dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/recurse-dir.c')
-rw-r--r--src/basic/recurse-dir.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
index 5e98b7a..7767331 100644
--- a/src/basic/recurse-dir.c
+++ b/src/basic/recurse-dir.c
@@ -4,6 +4,7 @@
#include "dirent-util.h"
#include "fd-util.h"
#include "fileio.h"
+#include "fs-util.h"
#include "missing_syscall.h"
#include "mountpoint-util.h"
#include "recurse-dir.h"
@@ -132,6 +133,18 @@ int readdir_all(int dir_fd,
return 0;
}
+int readdir_all_at(int fd, const char *path, RecurseDirFlags flags, DirectoryEntries **ret) {
+ _cleanup_close_ int dir_fd = -EBADF;
+
+ assert(fd >= 0 || fd == AT_FDCWD);
+
+ dir_fd = xopenat(fd, path, O_DIRECTORY|O_CLOEXEC);
+ if (dir_fd < 0)
+ return dir_fd;
+
+ return readdir_all(dir_fd, flags, ret);
+}
+
int recurse_dir(
int dir_fd,
const char *path,