| #include <selinux/selinux.h> |
| int load_policy_main(int argc, char **argv) |
| fprintf(stderr, "usage: %s policy-file\n", argv[0]); |
| fd = open(path, O_RDONLY); |
| fprintf(stderr, "Could not open %s: %s\n", path, strerror(errno)); |
| if (fstat(fd, &sb) < 0) { |
| fprintf(stderr, "Could not stat %s: %s\n", path, strerror(errno)); |
| map = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); |
| fprintf(stderr, "Could not mmap %s: %s\n", path, strerror(errno)); |
| rc = security_load_policy(map, sb.st_size); |
| fprintf(stderr, "Could not load %s: %s\n", path, strerror(errno)); |