From 2062ada74cd2124447aaf3cab9c854c3853146a0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 21 Mar 2018 11:48:40 +0100 Subject: [PATCH] selinux: let's fully (and statically) initialize log callback union (#8512) We can make this const and static, and initialize this ahead of time and fully, hence let's do that. --- src/core/selinux-setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/selinux-setup.c b/src/core/selinux-setup.c index 7135542106f..7b69b4c4c63 100644 --- a/src/core/selinux-setup.c +++ b/src/core/selinux-setup.c @@ -47,13 +47,15 @@ int mac_selinux_setup(bool *loaded_policy) { usec_t before_load, after_load; char *con; int r; - union selinux_callback cb; + static const union selinux_callback cb = { + .func_log = null_log, + }; + bool initialized = false; assert(loaded_policy); /* Turn off all of SELinux' own logging, we want to do that */ - cb.func_log = null_log; selinux_set_callback(SELINUX_CB_LOG, cb); /* Don't load policy in the initrd if we don't appear to have -- 2.47.3