source: MondoRescue/branches/stable/mindi-busybox/selinux/load_policy.c@ 1770

Last change on this file since 1770 was 1765, checked in by Bruno Cornec, 16 years ago

Update to busybox 1.7.2

  • Property svn:eol-style set to native
File size: 675 bytes
Line 
1/*
2 * load_policy
3 * This implementation is based on old load_policy to be small.
4 * Author: Yuichi Nakamura <ynakam@hitachisoft.jp>
5 */
6#include "libbb.h"
7
8int load_policy_main(int argc, char **argv);
9int load_policy_main(int argc, char **argv)
10{
11 int fd;
12 struct stat st;
13 void *data;
14 if (argc != 2) {
15 bb_show_usage();
16 }
17
18 fd = xopen(argv[1], O_RDONLY);
19 if (fstat(fd, &st) < 0) {
20 bb_perror_msg_and_die("can't fstat");
21 }
22 data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
23 if (data == MAP_FAILED) {
24 bb_perror_msg_and_die("can't mmap");
25 }
26 if (security_load_policy(data, st.st_size) < 0) {
27 bb_perror_msg_and_die("can't load policy");
28 }
29
30 return 0;
31}
Note: See TracBrowser for help on using the repository browser.