[LTP] [PATCH v2 2/5] tst_lockdown_enabled: Print lockdown state

Martin Doucha mdoucha@suse.cz
Tue Jul 25 13:04:17 CEST 2023


Hi,
Printing "Kernel lockdown: %s" instead would make more sense to the 
user. But that can be fixed during merge.

Reviewed-by: Martin Doucha <mdoucha@suse.cz>

On 21. 07. 23 11:15, Petr Vorel wrote:
> This will be used to simplify .skip_in_lockdown in next commit.
> 
> Suggested-by: Martin Doucha <mdoucha@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>   lib/tst_lockdown.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/tst_lockdown.c b/lib/tst_lockdown.c
> index 4ce4736c3..8f2ee6762 100644
> --- a/lib/tst_lockdown.c
> +++ b/lib/tst_lockdown.c
> @@ -47,6 +47,7 @@ int tst_lockdown_enabled(void)
>   {
>   	char line[BUFSIZ];
>   	FILE *file;
> +	int ret;
>   
>   	if (access(PATH_LOCKDOWN, F_OK) != 0) {
>   		char flag;
> @@ -65,5 +66,8 @@ int tst_lockdown_enabled(void)
>   		tst_brk(TBROK | TERRNO, "fgets %s", PATH_LOCKDOWN);
>   	SAFE_FCLOSE(file);
>   
> -	return (strstr(line, "[none]") == NULL);
> +	ret = strstr(line, "[none]") == NULL;
> +	tst_res(TINFO, "Lockdown: %s", ret ? "on" : "off");
> +
> +	return ret;
>   }

-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic



More information about the ltp mailing list