mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-12 00:55:03 +00:00
31 lines
713 B
C
31 lines
713 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
#include <selinux/avc.h>
|
||
|
|
||
|
|
||
|
int main(int argc __attribute__ ((unused)),
|
||
|
char* argv[] __attribute__ ((unused))) {
|
||
|
int rc;
|
||
|
|
||
|
/*
|
||
|
* Do not use netlink as fallback, since selinux_status_policyload(3)
|
||
|
* works only after a first message has been received.
|
||
|
*/
|
||
|
rc = selinux_status_open(/*fallback=*/0);
|
||
|
if (rc < 0) {
|
||
|
fprintf(stderr, "%s: failed to open SELinux status map: %m\n", argv[0]);
|
||
|
return EXIT_FAILURE;
|
||
|
}
|
||
|
|
||
|
rc = selinux_status_policyload();
|
||
|
if (rc < 0)
|
||
|
fprintf(stderr, "%s: failed to read policyload from SELinux status page: %m\n", argv[0]);
|
||
|
else
|
||
|
printf("%d\n", rc);
|
||
|
|
||
|
selinux_status_close();
|
||
|
|
||
|
return (rc < 0) ? EXIT_FAILURE : EXIT_SUCCESS;
|
||
|
}
|