summaryrefslogtreecommitdiffstats
path: root/src/basic/dirent-util.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-24 13:13:05 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-24 13:18:00 +0100
commit06da125ea19284a5200e206e704a37c17dbbab5e (patch)
tree15edfd06783b3966ff3ef1863a5780b4cce82afe /src/basic/dirent-util.c
parentTODO: add item about mnt_fstype_is_netfs() (diff)
downloadsystemd-06da125ea19284a5200e206e704a37c17dbbab5e.tar.xz
systemd-06da125ea19284a5200e206e704a37c17dbbab5e.zip
dirent-util: Expose dirent_ensure_type()
Diffstat (limited to 'src/basic/dirent-util.c')
-rw-r--r--src/basic/dirent-util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/dirent-util.c b/src/basic/dirent-util.c
index 2eea228c20..17df6a24c9 100644
--- a/src/basic/dirent-util.c
+++ b/src/basic/dirent-util.c
@@ -8,11 +8,11 @@
#include "stat-util.h"
#include "string-util.h"
-static int dirent_ensure_type(DIR *d, struct dirent *de) {
+int dirent_ensure_type(int dir_fd, struct dirent *de) {
STRUCT_STATX_DEFINE(sx);
int r;
- assert(d);
+ assert(dir_fd >= 0);
assert(de);
if (de->d_type != DT_UNKNOWN)
@@ -24,7 +24,7 @@ static int dirent_ensure_type(DIR *d, struct dirent *de) {
}
/* Let's ask only for the type, nothing else. */
- r = statx_fallback(dirfd(d), de->d_name, AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_TYPE, &sx);
+ r = statx_fallback(dir_fd, de->d_name, AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_TYPE, &sx);
if (r < 0)
return r;
@@ -80,7 +80,7 @@ struct dirent *readdir_ensure_type(DIR *d) {
if (!de)
return NULL;
- r = dirent_ensure_type(d, de);
+ r = dirent_ensure_type(dirfd(d), de);
if (r >= 0)
return de;
if (r != -ENOENT) {