[LTP] [PATCH v3 1/2] core: add tst_selinux_enabled() utility
    Cyril Hrubis 
    chrubis@suse.cz
       
    Wed Jul  9 15:34:33 CEST 2025
    
    
  
Hi!
> +int tst_selinux_enabled(void)
> +{
> +	int res = 0;
> +
> +	if (access(SELINUX_PATH, F_OK) == 0 && !tst_dir_is_empty(SELINUX_PATH, 0))
> +		res = 1;
Maybe we we can do tst_is_mounted(SELINUX_PATH) here instead. At least
that seems to be what is_selinux_enabled() seems to be doing.
> +	tst_res(TINFO, "SELinux enabled: %s", res ? "yes" : "no");
> +
> +	return res;
> +}
> +
>  int tst_selinux_enforcing(void)
>  {
>  	int res = 0;
> 
> -- 
> 2.50.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
-- 
Cyril Hrubis
chrubis@suse.cz
    
    
More information about the ltp
mailing list