[LTP] [PATCH v4 1/2] core: add tst_selinux_enabled() utility
Andrea Cervesato
andrea.cervesato@suse.com
Wed Jul 23 13:19:11 CEST 2025
On 7/22/25 2:06 PM, Petr Vorel wrote:
> +++ lib/tst_security.c
> @@ -107,7 +107,7 @@ int tst_selinux_enabled(void)
> {
> int res = 0;
>
> - if (tst_is_mounted(SELINUX_PATH))
> + if (access(SELINUX_STATUS_PATH, F_OK) == 0)
> res = 1;
>
> tst_res(TINFO, "SELinux enabled: %s", res ? "yes" : "no");
This is more or less what I was doing at the beginning, but Cyril
suggested this approach which is more similar to libselinux. Please,
check v3.
- Andrea
More information about the ltp
mailing list