summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-06-25 13:03:55 +0200
committerLennart Poettering <lennart@poettering.net>2024-07-01 16:02:05 +0200
commita8db162d8a06788c0aa30c863196357f5e367c61 (patch)
tree400bbd9d47e914e8ce1669195f2cd3ecf4ed8d5c /src/shared
parentstat-util: port inode_same_at() to use FID file handle data to determine inod... (diff)
downloadsystemd-a8db162d8a06788c0aa30c863196357f5e367c61.tar.xz
systemd-a8db162d8a06788c0aa30c863196357f5e367c61.zip
test: beef up test case for fid-based equality checks
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);