summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-07-01 18:53:14 +0200
committerGitHub <noreply@github.com>2024-07-01 18:53:14 +0200
commit1c30bf35bccd77b91ff871ec5ef03d082d4b6f87 (patch)
tree945a00b2b5aca85dfe8f65f4e59ec6a538930d47 /src/shared
parentmkfs-util: Simplify logic (diff)
parenttest: beef up test case for fid-based equality checks (diff)
downloadsystemd-1c30bf35bccd77b91ff871ec5ef03d082d4b6f87.tar.xz
systemd-1c30bf35bccd77b91ff871ec5ef03d082d4b6f87.zip
Merge pull request #33475 from poettering/name-to-handle-at-fid
teach inode_same() the concept of name_to_handle_at() FIDs to properly detect inode identities
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/mount-util.c10
-rw-r--r--src/shared/mount-util.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c
index a1f4bee77e..7e18d12df4 100644
--- a/src/shared/mount-util.c
+++ b/src/shared/mount-util.c
@@ -1815,3 +1815,13 @@ int make_fsmount(
return TAKE_FD(mnt_fd);
}
+
+char* umount_and_unlink_and_free(char *p) {
+ if (!p)
+ return NULL;
+
+ PROTECT_ERRNO;
+ (void) umount2(p, 0);
+ (void) unlink(p);
+ return mfree(p);
+}
diff --git a/src/shared/mount-util.h b/src/shared/mount-util.h
index 26d96b27b7..20c63e137f 100644
--- a/src/shared/mount-util.h
+++ b/src/shared/mount-util.h
@@ -100,6 +100,9 @@ static inline char *umount_and_free(char *p) {
}
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_free);
+char* umount_and_unlink_and_free(char *p);
+DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_unlink_and_free);
+
int bind_mount_in_namespace(PidRef *target, const char *propagate_path, const char *incoming_path, const char *src, const char *dest, bool read_only, bool make_file_or_directory);
int mount_image_in_namespace(PidRef *target, const char *propagate_path, const char *incoming_path, const char *src, const char *dest, bool read_only, bool make_file_or_directory, const MountOptions *options, const ImagePolicy *image_policy);