]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
selinux: let's fully (and statically) initialize log callback union (#8512)
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Mar 2018 10:48:40 +0000 (11:48 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 21 Mar 2018 10:48:40 +0000 (11:48 +0100)
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

index 7135542106fc014eef10b54cd06f675c495333a6..7b69b4c4c63b0759ef47e4b469f0ee3ffb8371f1 100644 (file)
@@ -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