diff options
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/smack-util.c | 21 | ||||
-rw-r--r-- | src/basic/smack-util.h | 2 | ||||
-rw-r--r-- | src/basic/util.h | 5 |
3 files changed, 22 insertions, 6 deletions
diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c index 6d5c205117..9e221d6eab 100644 --- a/src/basic/smack-util.c +++ b/src/basic/smack-util.c @@ -185,6 +185,23 @@ int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { return r; } +int mac_smack_copy(const char *dest, const char *src) { + int r = 0; + _cleanup_free_ char *label = NULL; + + assert(dest); + assert(src); + + r = mac_smack_read(src, SMACK_ATTR_ACCESS, &label); + if (r < 0) + return r; + + r = mac_smack_apply(dest, SMACK_ATTR_ACCESS, label); + if (r < 0) + return r; + + return r; +} #else bool mac_smack_use(void) { @@ -214,4 +231,8 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { return 0; } + +int mac_smack_copy(const char *dest, const char *src) { + return 0; +} #endif diff --git a/src/basic/smack-util.h b/src/basic/smack-util.h index 1052cecf4c..b3aa55eb8a 100644 --- a/src/basic/smack-util.h +++ b/src/basic/smack-util.h @@ -48,5 +48,5 @@ int mac_smack_read(const char *path, SmackAttr attr, char **label); int mac_smack_read_fd(int fd, SmackAttr attr, char **label); int mac_smack_apply(const char *path, SmackAttr attr, const char *label); int mac_smack_apply_fd(int fd, SmackAttr attr, const char *label); - int mac_smack_apply_pid(pid_t pid, const char *label); +int mac_smack_copy(const char *dest, const char *src); diff --git a/src/basic/util.h b/src/basic/util.h index 48567756b9..5fa44b5cf3 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -877,11 +877,6 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra int extract_first_word_and_warn(const char **p, char **ret, const char *separators, ExtractFlags flags, const char *unit, const char *filename, unsigned line, const char *rvalue); int extract_many_words(const char **p, const char *separators, ExtractFlags flags, ...) _sentinel_; -static inline void free_and_replace(char **s, char *v) { - free(*s); - *s = v; -} - int free_and_strdup(char **p, const char *s); #define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1) |