]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
selinux-util: Make clang-tidy happy if selinux is not available
authorDaan De Meyer <daan@amutable.com>
Fri, 20 Mar 2026 20:38:27 +0000 (21:38 +0100)
committerDaan De Meyer <daan@amutable.com>
Fri, 20 Mar 2026 20:51:43 +0000 (21:51 +0100)
Most of our libraries are available on all distributions so we don't
bother with making clang-tidy happy if the library is not available.
The one exception is selinux which isn't available on Arch. Let's
conditionalize the includes in selinux-util.c so that clang-tidy is
still happy on Arch where we can't install libselinux.

src/shared/selinux-util.c

index f980ec83acb4f996fd13a97fca7f38350b6a16ac..1049044f87bbd2f4ca69e8e9c5eeb568ceef1d39 100644 (file)
@@ -1,32 +1,34 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <fcntl.h>
-#include <malloc.h>
-#include <string.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
-#include <sys/un.h>
 #include <syslog.h>
 
 #if HAVE_SELINUX
+#include <malloc.h>
+#include <string.h>
+#include <sys/un.h>
+
 #include <selinux/avc.h>
 #include <selinux/context.h>
 #include <selinux/label.h>
 #include <selinux/selinux.h>
-#endif
 
 #include "sd-dlopen.h"
 
 #include "alloc-util.h"
-#include "errno-util.h"
 #include "fd-util.h"
 #include "label.h"
-#include "label-util.h"
 #include "log.h"
 #include "path-util.h"
-#include "selinux-util.h"
 #include "string-util.h"
 #include "time-util.h"
+#endif
+
+#include "errno-util.h"
+#include "label-util.h"
+#include "selinux-util.h"
 
 #if HAVE_SELINUX
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(context_t, sym_context_free, context_freep, NULL);