]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
selinux: improve debug log format
authorChristian Göttsche <cgzones@googlemail.com>
Wed, 28 Jul 2021 14:59:57 +0000 (16:59 +0200)
committerTopi Miettinen <topimiettinen@users.noreply.github.com>
Sat, 20 Nov 2021 16:38:03 +0000 (16:38 +0000)
path might be NULL when checking against the system permissions, so wrap
with strna().

The command line might not be available over D-Bus and thus cl might be
empty. Print "n/a" instead of the empty string.

src/core/selinux-access.c

index f6d4e7cc5082bd24565d95e6f48983c68be0dc5b..6afc64a7b16f15cc2ab217fd86dedec40956f89a 100644 (file)
@@ -280,7 +280,7 @@ int mac_selinux_generic_access_check(
 
         log_full_errno_zerook(LOG_DEBUG, r,
                               "SELinux access check scon=%s tcon=%s tclass=%s perm=%s state=%s function=%s path=%s cmdline=%s: %m",
-                              scon, fcon, tclass, permission, enforce ? "enforcing" : "permissive", function, path, cl);
+                              scon, fcon, tclass, permission, enforce ? "enforcing" : "permissive", function, strna(path), isempty(cl) ? "n/a" : cl);
         return enforce ? r : 0;
 }