blob: e7c19813c2afc7a1784fb4bf8af5a27b1479ea13 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// SPDX-License-Identifier: GPL-2.0-or-later
#define TST_NO_DEFAULT_MAIN
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include "tst_test.h"
#include "tst_safe_macros.h"
#include "tst_safe_stdio.h"
#include "tst_lockdown.h"
int tst_lockdown_enabled(void)
{
char line[BUFSIZ];
FILE *file;
if (access(PATH_LOCKDOWN, F_OK) != 0) {
tst_res(TINFO, "Unable to determine system lockdown state");
return 0;
}
file = SAFE_FOPEN(PATH_LOCKDOWN, "r");
if (!fgets(line, sizeof(line), file))
tst_brk(TBROK | TERRNO, "fgets %s", PATH_LOCKDOWN);
SAFE_FCLOSE(file);
return (strstr(line, "[none]") == NULL);
}
|