summaryrefslogtreecommitdiff
path: root/src
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
parent0b786cdba28e6f0db7a86077a77fa3a06fcc3bf9 (diff)
src/shared/label.c: move and rename symlink_label()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/shared/dev-setup.c22
-rw-r--r--src/shared/label.c21
-rw-r--r--src/shared/label.h2
3 files changed, 25 insertions, 20 deletions
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c
index fb16a8a8cc..c9eb0a5efc 100644
--- a/src/shared/dev-setup.c
+++ b/src/shared/dev-setup.c
@@ -30,24 +30,6 @@
#include "util.h"
#include "label.h"
-static int symlink_and_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();
-
- return r;
-}
-
int dev_setup(const char *prefix) {
const char *j, *k;
@@ -73,9 +55,9 @@ int dev_setup(const char *prefix) {
if (!link_name)
return -ENOMEM;
- symlink_and_label(j, link_name);
+ symlink_label(j, link_name);
} else
- symlink_and_label(j, k);
+ symlink_label(j, k);
}
return 0;
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);
+}
diff --git a/src/shared/label.h b/src/shared/label.h
index 72d455d6fb..ba1e2559e9 100644
--- a/src/shared/label.h
+++ b/src/shared/label.h
@@ -23,3 +23,5 @@
#include "smack-util.h"
int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
+
+int symlink_label(const char *old_path, const char *new_path);