summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2015-03-28 15:29:05 -0500
committerElliott Hughes2015-03-28 15:29:05 -0500
commitf29940559acb9e621566614f685ecdbd52483643 (patch)
tree5f744ad0e8237c4c9a264802f6ee8e1e1b41bd46
parent48402951cfd44217ba50dbce5cc742db95d915c6 (diff)
downloadplatform-system-core-f29940559acb9e621566614f685ecdbd52483643.tar.gz
platform-system-core-f29940559acb9e621566614f685ecdbd52483643.tar.xz
platform-system-core-f29940559acb9e621566614f685ecdbd52483643.zip
Lose load_policy to toybox.
Change-Id: I3ef3aab9eef8e07ee598e2559a316e2fccf7199b
-rw-r--r--toolbox/Android.mk1
-rw-r--r--toolbox/load_policy.c49
2 files changed, 0 insertions, 50 deletions
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index a0a9909aa..28366f437 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -47,7 +47,6 @@ OUR_TOOLS := \
47 iftop \ 47 iftop \
48 ioctl \ 48 ioctl \
49 ionice \ 49 ionice \
50 load_policy \
51 log \ 50 log \
52 ls \ 51 ls \
53 lsof \ 52 lsof \
diff --git a/toolbox/load_policy.c b/toolbox/load_policy.c
deleted file mode 100644
index 90d48c4fa..000000000
--- a/toolbox/load_policy.c
+++ /dev/null
@@ -1,49 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <unistd.h>
5#include <fcntl.h>
6#include <sys/stat.h>
7#include <sys/mman.h>
8#include <errno.h>
9#include <selinux/selinux.h>
10
11int load_policy_main(int argc, char **argv)
12{
13 int fd, rc;
14 struct stat sb;
15 void *map;
16 const char *path;
17
18 if (argc != 2) {
19 fprintf(stderr, "usage: %s policy-file\n", argv[0]);
20 exit(1);
21 }
22
23 path = argv[1];
24 fd = open(path, O_RDONLY);
25 if (fd < 0) {
26 fprintf(stderr, "Could not open %s: %s\n", path, strerror(errno));
27 exit(2);
28 }
29
30 if (fstat(fd, &sb) < 0) {
31 fprintf(stderr, "Could not stat %s: %s\n", path, strerror(errno));
32 exit(3);
33 }
34
35 map = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
36 if (map == MAP_FAILED) {
37 fprintf(stderr, "Could not mmap %s: %s\n", path, strerror(errno));
38 exit(4);
39 }
40
41 rc = security_load_policy(map, sb.st_size);
42 if (rc < 0) {
43 fprintf(stderr, "Could not load %s: %s\n", path, strerror(errno));
44 exit(5);
45 }
46 munmap(map, sb.st_size);
47 close(fd);
48 exit(0);
49}