[LTP] [PATCH v2 2/5] tst_lockdown_enabled: Print lockdown state
Petr Vorel
pvorel@suse.cz
Fri Jul 21 11:15:12 CEST 2023
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;
}
--
2.40.1
More information about the ltp
mailing list