selinux-util: Make clang-tidy happy if selinux is not available

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.
This commit is contained in:
Daan De Meyer
2026-03-20 21:51:43 +01:00
parent 0b2432438c
commit 5ae78f0ca9
+9 -7
View 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);