blob: ce7899a64e5259737f74d7002c717d840ed1e95f (
plain)
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
31
32
33
34
|
#include <smack-check.h>
#include <stdlib.h>
#include <sys/smack.h>
#include <dpl/log/log.h>
namespace CKM {
int smack_runtime_check(void)
{
static int smack_present = -1;
if (-1 == smack_present) {
if (NULL == smack_smackfs_path()) {
LogDebug("no smack found on device");
smack_present = 0;
} else {
LogDebug("found smack on device");
smack_present = 1;
}
}
return smack_present;
}
int smack_check(void)
{
#ifndef SMACK_ENABLED
return 0;
#else
return smack_runtime_check();
#endif
}
} // namespace CKM
|