1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-10 01:17:44 +03:00

mountpoint-util: do not assume symlinks are not mountpoints

They very much can be with the new mount API.

(cherry picked from commit 36e48f22af102843b6cceeda5a2292e57434d2ee)
(cherry picked from commit 99cb4bdbbb15f3812de7f0fd161f91335000790d)
This commit is contained in:
Mike Yuan 2024-06-26 18:11:30 +02:00 committed by Luca Boccassi
parent 02e50f7a4b
commit 98a4c8009b

View File

@ -231,8 +231,6 @@ int fd_is_mount_point(int fd, const char *filename, int flags) {
/* If statx() is not available or forbidden, fall back to name_to_handle_at() below */
} else if (FLAGS_SET(sx.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) /* yay! */
return FLAGS_SET(sx.stx_attributes, STATX_ATTR_MOUNT_ROOT);
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);
if (r < 0) {
@ -311,8 +309,6 @@ fallback_fstat:
flags |= AT_SYMLINK_NOFOLLOW;
if (fstatat(fd, filename, &a, flags) < 0)
return -errno;
if (S_ISLNK(a.st_mode)) /* Symlinks are never mount points */
return false;
if (isempty(filename))
r = fstatat(fd, "..", &b, 0);