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

index 5f62e383a440c96fa0ee5d41d6b3fedaa3eca03a..10c4f75efd283ecbe01ff63a063bdc3752d75461 100644 (file)
@@ -263,9 +263,14 @@ int is_mount_point_at(int dir_fd, const char *path, int flags) {
         /* When running on chroot environment, the root may not be a mount point, but we unconditionally
          * return true when the input is "/" in the above, but the shortcut may not work e.g. when the path
          * is relative. */
-        struct statx sx2 = {}; /* explicitly initialize the struct to make msan silent. */
-        if (statx(AT_FDCWD, "/", AT_STATX_DONT_SYNC, STATX_TYPE|STATX_INO, &sx2) < 0)
-                return -errno;
+        struct statx sx2;
+        r = xstatx(AT_FDCWD,
+                   "/",
+                   AT_STATX_DONT_SYNC,
+                   STATX_TYPE|STATX_INO,
+                   &sx2);
+        if (r < 0)
+                return r;
 
         return statx_inode_same(&sx, &sx2);
 }