mount-util: add umount_and_free() helper

This commit is contained in:
Lennart Poettering
2023-05-16 09:24:45 +02:00
parent f44744ff51
commit a789f72ed2
+8
View File
@@ -83,6 +83,14 @@ static inline char* umount_and_rmdir_and_free(char *p) {
}
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_rmdir_and_free);
static inline char *umount_and_free(char *p) {
PROTECT_ERRNO;
if (p)
(void) umount_recursive(p, 0);
return mfree(p);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_free);
int bind_mount_in_namespace(pid_t 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(pid_t 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);