]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dirent-util: use xstatx_full() some more
authorLennart Poettering <lennart@amutable.com>
Thu, 5 Feb 2026 15:40:57 +0000 (16:40 +0100)
committerLennart Poettering <lennart@amutable.com>
Mon, 9 Feb 2026 09:33:01 +0000 (10:33 +0100)
src/basic/dirent-util.c

index 2d0c10f6fef6384098da006e7c99db9be47e2caf..a1508747777a0020d7cb3bb47755931c0f850663 100644 (file)
@@ -5,10 +5,11 @@
 
 #include "dirent-util.h"
 #include "path-util.h"
+#include "stat-util.h"
 #include "string-util.h"
 
 int dirent_ensure_type(int dir_fd, struct dirent *de) {
-        struct statx sx;
+        int r;
 
         assert(dir_fd >= 0);
         assert(de);
@@ -22,8 +23,16 @@ int dirent_ensure_type(int dir_fd, struct dirent *de) {
         }
 
         /* Let's ask only for the type, nothing else. */
-        if (statx(dir_fd, de->d_name, AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_TYPE, &sx) < 0)
-                return -errno;
+        struct statx sx;
+        r = xstatx_full(dir_fd,
+                        de->d_name,
+                        AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT,
+                        /* mandatory_mask= */ STATX_TYPE,
+                        /* optional_mask= */ STATX_INO,
+                        /* mandatory_attributes= */ 0,
+                        &sx);
+        if (r < 0)
+                return r;
 
         assert(FLAGS_SET(sx.stx_mask, STATX_TYPE));
         de->d_type = IFTODT(sx.stx_mode);