]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: add check for security_get_initial_context()
authorKarel Zak <kzak@redhat.com>
Thu, 19 Mar 2026 12:39:52 +0000 (13:39 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 24 Mar 2026 09:21:15 +0000 (10:21 +0100)
The mount command uses HAVE_SECURITY_GET_INITIAL_CONTEXT to enable
SELinux context warnings. This check was missing in meson, leaving
that code path dead in meson builds.

Autotools checks for this function in configure.ac since it may be
missing in old libselinux 1.xx versions.

Signed-off-by: Karel Zak <kzak@redhat.com>
meson.build

index ec7b8d9c69635e9909eb3e8bf5783cda132c8d08..6bb4d1d929914272675ac1e535cdccff340e783b 100644 (file)
@@ -473,6 +473,11 @@ lib_selinux = dependency(
   version : '>= 2.5',
   required : get_option('selinux'))
 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
+if lib_selinux.found()
+  have = cc.has_function('security_get_initial_context',
+                         dependencies : lib_selinux)
+  conf.set('HAVE_SECURITY_GET_INITIAL_CONTEXT', have ? 1 : false)
+endif
 
 lib_magic = dependency(
   'libmagic',