summaryrefslogtreecommitdiff
path: root/src/shared/label.c
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2014-10-26 12:08:16 -0400
committerAnthony G. Basile <blueness@gentoo.org>2014-10-26 12:08:16 -0400
commit1040c8000f851b93ed77719752575f8b0c25a88a (patch)
tree4da88104c88dbed073b8902ab2d955358787c47f /src/shared/label.c
parent0b786cdba28e6f0db7a86077a77fa3a06fcc3bf9 (diff)
src/shared/label.c: move and rename symlink_label()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared/label.c')
-rw-r--r--src/shared/label.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/shared/label.c b/src/shared/label.c
index 44b1eca0c2..6c0e96f970 100644
--- a/src/shared/label.c
+++ b/src/shared/label.c
@@ -33,3 +33,24 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
return 0;
}
+
+int symlink_label(const char *old_path, const char *new_path) {
+ int r;
+
+ assert(old_path);
+ assert(new_path);
+
+ r = mac_selinux_create_file_prepare(new_path, S_IFLNK);
+ if (r < 0)
+ return r;
+
+ if (symlink(old_path, new_path) < 0)
+ r = -errno;
+
+ mac_selinux_create_file_clear();
+
+ if (r < 0)
+ return r;
+
+ return mac_smack_fix(new_path, false, false);
+}