From: Zbigniew Jędrzejewski-Szmek Date: Tue, 19 Dec 2017 13:33:11 +0000 (+0100) Subject: Move selinux-related stuff from btrfs-util.c to label.c X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2e26218217c36b88b6a24b528c9607247e06a495;p=elogind.git Move selinux-related stuff from btrfs-util.c to label.c In preparation for future changes. --- diff --git a/src/basic/label.c b/src/basic/label.c index 17857de1b..8a2d87818 100644 --- a/src/basic/label.c +++ b/src/basic/label.c @@ -22,6 +22,7 @@ #include #include +//#include "btrfs-util.h" #include "label.h" #include "macro.h" #include "selinux-util.h" @@ -83,3 +84,21 @@ int symlink_label(const char *old_path, const char *new_path) { return mac_smack_fix(new_path, false, false); } #endif // 0 + +int btrfs_subvol_make_label(const char *path) { + int r; + + assert(path); + + r = mac_selinux_create_file_prepare(path, S_IFDIR); + if (r < 0) + return r; + + r = btrfs_subvol_make(path); + mac_selinux_create_file_clear(); + + if (r < 0) + return r; + + return mac_smack_fix(path, false, false); +} diff --git a/src/basic/label.h b/src/basic/label.h index fa49c2e20..df25d8baf 100644 --- a/src/basic/label.h +++ b/src/basic/label.h @@ -29,3 +29,5 @@ int mkdir_label(const char *path, mode_t mode); #if 0 /// UNNEEDED by elogind int symlink_label(const char *old_path, const char *new_path); #endif // 0 + +int btrfs_subvol_make_label(const char *path);