summaryrefslogtreecommitdiffstats
path: root/src/basic/mountpoint-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-06-25 12:44:19 +0200
committerLennart Poettering <lennart@poettering.net>2024-07-01 15:45:15 +0200
commit4c39ab9b402bd87ed590c8781e9c30d786178a12 (patch)
tree31e3ddc5954327bb1e0c912980e7162119a47e08 /src/basic/mountpoint-util.c
parentmountpoint-util: add new helper name_to_handle_at_try_fid() (diff)
downloadsystemd-4c39ab9b402bd87ed590c8781e9c30d786178a12.tar.xz
systemd-4c39ab9b402bd87ed590c8781e9c30d786178a12.zip
mountpoint-util: use the FID stuff for detecting the root of mounts
In the unlikely event that sandboxes block statx() but let name_to_handle_at() through it's a good way to determine the root inode of the namespace, since its parent inode will have the same FID and mnt_id.
Diffstat (limited to '')
-rw-r--r--src/basic/mountpoint-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index 71979d29ad..c9cf1bcdac 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -276,7 +276,7 @@ int fd_is_mount_point(int fd, const char *filename, int flags) {
else if (FLAGS_SET(sx.stx_mask, STATX_TYPE) && S_ISLNK(sx.stx_mode))
return false; /* symlinks are never mount points */
- r = name_to_handle_at_loop(fd, filename, &h, &mount_id, flags);
+ r = name_to_handle_at_try_fid(fd, filename, &h, &mount_id, flags);
if (r < 0) {
if (is_name_to_handle_at_fatal_error(r))
return r;
@@ -290,9 +290,9 @@ int fd_is_mount_point(int fd, const char *filename, int flags) {
}
if (isempty(filename))
- r = name_to_handle_at_loop(fd, "..", &h_parent, &mount_id_parent, 0); /* can't work for non-directories 😢 */
+ r = name_to_handle_at_try_fid(fd, "..", &h_parent, &mount_id_parent, 0); /* can't work for non-directories 😢 */
else
- r = name_to_handle_at_loop(fd, "", &h_parent, &mount_id_parent, AT_EMPTY_PATH);
+ r = name_to_handle_at_try_fid(fd, "", &h_parent, &mount_id_parent, AT_EMPTY_PATH);
if (r < 0) {
if (is_name_to_handle_at_fatal_error(r))
return r;