summaryrefslogtreecommitdiffstats
path: root/src/basic/stat-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-07-13 23:43:36 +0200
committerLennart Poettering <lennart@poettering.net>2022-07-14 10:11:50 +0200
commita586dc791ca465f4087473d2ad6794b7776aee2d (patch)
treefd246146bafeea2560816c62914b28d2f905810f /src/basic/stat-util.h
parentsd-bus: do not pass NULL when received message with invalid type (diff)
downloadsystemd-a586dc791ca465f4087473d2ad6794b7776aee2d.tar.xz
systemd-a586dc791ca465f4087473d2ad6794b7776aee2d.zip
stat-util: replace is_dir() + is_dir_fd() by single is_dir_full() call
This new call can execute both of the old operations, but also do generic fstatat() like behaviour.
Diffstat (limited to 'src/basic/stat-util.h')
-rw-r--r--src/basic/stat-util.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h
index 7f0b3dc0af..56f15534aa 100644
--- a/src/basic/stat-util.h
+++ b/src/basic/stat-util.h
@@ -13,8 +13,13 @@
#include "missing_stat.h"
int is_symlink(const char *path);
-int is_dir(const char *path, bool follow);
-int is_dir_fd(int fd);
+int is_dir_full(int atfd, const char *fname, bool follow);
+static inline int is_dir(const char *path, bool follow) {
+ return is_dir_full(AT_FDCWD, path, follow);
+}
+static inline int is_dir_fd(int fd) {
+ return is_dir_full(fd, NULL, false);
+}
int is_device_node(const char *path);
int dir_is_empty_at(int dir_fd, const char *path, bool ignore_hidden_or_backup);