summaryrefslogtreecommitdiffstats
path: root/src/shared/selinux-util.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-05-21 14:41:38 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-06-12 15:21:21 +0200
commit6623c64a02fae52103cdc9c80dfcabec9eeaf8ba (patch)
treeef1ee4307dcd0f760386967a9ed577a42adfeb3d /src/shared/selinux-util.h
parentbasic/dlfcn-util: deobfuscate macro definitions (diff)
downloadsystemd-6623c64a02fae52103cdc9c80dfcabec9eeaf8ba.tar.xz
systemd-6623c64a02fae52103cdc9c80dfcabec9eeaf8ba.zip
selinux: kill mac_selinux_free()
It was a redundant wrapper around freecon. test-selinux needs to be adjusted because it now needs to be linked to libselinux, instead of pulling it in via libshared.
Diffstat (limited to 'src/shared/selinux-util.h')
-rw-r--r--src/shared/selinux-util.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/shared/selinux-util.h b/src/shared/selinux-util.h
index 97ab5ebb2f..038456fcca 100644
--- a/src/shared/selinux-util.h
+++ b/src/shared/selinux-util.h
@@ -13,9 +13,15 @@
#include <selinux/selinux.h>
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, freecon, NULL);
-#define _cleanup_freecon_ _cleanup_(freeconp)
+#else
+static inline char* freeconp(char **p) {
+ assert(*p == NULL);
+ return NULL;
+}
#endif
+#define _cleanup_freecon_ _cleanup_(freeconp)
+
bool mac_selinux_use(void);
void mac_selinux_retest(void);
bool mac_selinux_enforcing(void);
@@ -33,7 +39,6 @@ int mac_selinux_apply_fd(int fd, const char *path, const char *label);
int mac_selinux_get_create_label_from_exe(const char *exe, char **label);
int mac_selinux_get_our_label(char **label);
int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label);
-char* mac_selinux_free(char *label);
int mac_selinux_create_file_prepare_at(int dirfd, const char *path, mode_t mode);
static inline int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
@@ -46,5 +51,3 @@ int mac_selinux_create_socket_prepare(const char *label);
void mac_selinux_create_socket_clear(void);
int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(char*, mac_selinux_free);