changeset 1758:f9bb7e69402d

Promote load_policy to android.
author Rob Landley <rob@landley.net>
date Fri, 27 Mar 2015 20:50:28 -0500
parents 7ced29d424b7
children fa8f0a5dfc11
files toys/android/load_policy.c toys/pending/load_policy.c
diffstat 2 files changed, 37 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/android/load_policy.c	Fri Mar 27 20:50:28 2015 -0500
@@ -0,0 +1,37 @@
+/* load_policy.c - Load a policy file
+ *
+ * Copyright 2015 The Android Open Source Project
+
+USE_LOAD_POLICY(NEWTOY(load_policy, "<1>1", TOYFLAG_USR|TOYFLAG_SBIN))
+
+config LOAD_POLICY
+  bool "load_policy"
+  depends on TOYBOX_SELINUX
+  default y
+  help
+    usage: load_policy FILE
+
+    Load the specified policy file.
+*/
+
+#define FOR_load_policy
+#include "toys.h"
+
+void load_policy_main(void)
+{
+  char *path = *toys.optargs;
+  char *policy_data = 0;
+  off_t policy_len;
+  int fd;
+
+  if ((fd = open(path, O_RDONLY)) != -1) {
+    policy_len = fdlength(fd);
+    policy_data = mmap(0, policy_len, PROT_READ, MAP_PRIVATE, fd, 0);
+    close(fd);
+  }
+
+  if (!policy_data || security_load_policy(policy_data, policy_len) < 0)
+    perror_exit("Couldn't %s %s: %s", policy_data ? "load" : "read", path);
+
+  munmap(policy_data, policy_len);
+}
--- a/toys/pending/load_policy.c	Fri Mar 27 20:48:12 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/* load_policy.c - Load a policy file
- *
- * Copyright 2015 The Android Open Source Project
-
-USE_LOAD_POLICY(NEWTOY(load_policy, "<1>1", TOYFLAG_USR|TOYFLAG_SBIN))
-
-config LOAD_POLICY
-  bool "load_policy"
-  depends on TOYBOX_SELINUX
-  default n
-  help
-    usage: load_policy FILE
-
-    Load the specified policy file.
-*/
-
-#define FOR_load_policy
-#include "toys.h"
-
-void load_policy_main(void)
-{
-  char *path = *toys.optargs;
-  char *policy_data = 0;
-  off_t policy_len;
-  int fd;
-
-  if ((fd = open(path, O_RDONLY)) != -1) {
-    policy_len = fdlength(fd);
-    policy_data = mmap(0, policy_len, PROT_READ, MAP_PRIVATE, fd, 0);
-    close(fd);
-  }
-
-  if (!policy_data || security_load_policy(policy_data, policy_len) < 0)
-    perror_exit("Couldn't %s %s: %s", policy_data ? "load" : "read", path);
-
-  munmap(policy_data, policy_len);
-}