diff options
| author | Elliott Hughes <enh@google.com> | 2015-03-28 20:35:04 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-03-28 20:35:05 +0000 |
| commit | 934102baf8fca57abf63df7f134e977e696722db (patch) | |
| tree | 5f744ad0e8237c4c9a264802f6ee8e1e1b41bd46 | |
| parent | 48402951cfd44217ba50dbce5cc742db95d915c6 (diff) | |
| parent | f29940559acb9e621566614f685ecdbd52483643 (diff) | |
Merge "Lose load_policy to toybox."
| -rw-r--r-- | toolbox/Android.mk | 1 | ||||
| -rw-r--r-- | toolbox/load_policy.c | 49 |
2 files changed, 0 insertions, 50 deletions
diff --git a/toolbox/Android.mk b/toolbox/Android.mk index a0a9909aaf..28366f4378 100644 --- a/toolbox/Android.mk +++ b/toolbox/Android.mk @@ -47,7 +47,6 @@ OUR_TOOLS := \ iftop \ ioctl \ ionice \ - load_policy \ log \ ls \ lsof \ diff --git a/toolbox/load_policy.c b/toolbox/load_policy.c deleted file mode 100644 index 90d48c4fa4..0000000000 --- a/toolbox/load_policy.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/mman.h> -#include <errno.h> -#include <selinux/selinux.h> - -int load_policy_main(int argc, char **argv) -{ - int fd, rc; - struct stat sb; - void *map; - const char *path; - - if (argc != 2) { - fprintf(stderr, "usage: %s policy-file\n", argv[0]); - exit(1); - } - - path = argv[1]; - fd = open(path, O_RDONLY); - if (fd < 0) { - fprintf(stderr, "Could not open %s: %s\n", path, strerror(errno)); - exit(2); - } - - if (fstat(fd, &sb) < 0) { - fprintf(stderr, "Could not stat %s: %s\n", path, strerror(errno)); - exit(3); - } - - map = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); - if (map == MAP_FAILED) { - fprintf(stderr, "Could not mmap %s: %s\n", path, strerror(errno)); - exit(4); - } - - rc = security_load_policy(map, sb.st_size); - if (rc < 0) { - fprintf(stderr, "Could not load %s: %s\n", path, strerror(errno)); - exit(5); - } - munmap(map, sb.st_size); - close(fd); - exit(0); -} |
