summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/basic/selinux-util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
index cfc8464c66..ee9e34ed47 100644
--- a/src/basic/selinux-util.c
+++ b/src/basic/selinux-util.c
@@ -272,6 +272,8 @@ int mac_selinux_fix_container_fd(int fd, const char *path, const char *inside_pa
/* Check for policy reload so 'label_hnd' is kept up-to-date by callbacks */
mac_selinux_maybe_reload();
+ if (!label_hnd)
+ return 0;
if (selabel_lookup_raw(label_hnd, &fcon, inside_path, st.st_mode) < 0) {
/* If there's no label to set, then exit without warning */
@@ -484,6 +486,8 @@ static int selinux_create_file_prepare_abspath(const char *abspath, mode_t mode)
/* Check for policy reload so 'label_hnd' is kept up-to-date by callbacks */
mac_selinux_maybe_reload();
+ if (!label_hnd)
+ return 0;
r = selabel_lookup_raw(label_hnd, &filecon, abspath, mode);
if (r < 0) {
@@ -506,7 +510,6 @@ int mac_selinux_create_file_prepare_at(int dirfd, const char *path, mode_t mode)
_cleanup_free_ char *abspath = NULL;
int r;
-
assert(path);
if (!label_hnd)
@@ -628,6 +631,8 @@ int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) {
/* Check for policy reload so 'label_hnd' is kept up-to-date by callbacks */
mac_selinux_maybe_reload();
+ if (!label_hnd)
+ goto skipped;
if (path_is_absolute(path))
r = selabel_lookup_raw(label_hnd, &fcon, path, S_IFSOCK);