summaryrefslogtreecommitdiffstats
path: root/recovery.c
diff options
context:
space:
mode:
authorKenny Root <kroot@android.com>2012-03-31 00:18:10 +0200
committerandroid code review <noreply-gerritcodereview@google.com>2012-03-31 00:18:11 +0200
commit155cd3c155004433215147437cdf71844c9efd87 (patch)
tree46aacb687e7126a5a64949dd7ade2f284ee57c15 /recovery.c
parentReconcile with ics-mr1-release (diff)
parentExtend recovery and updater to support setting file security contexts. (diff)
downloadandroid_bootable_recovery-155cd3c155004433215147437cdf71844c9efd87.tar
android_bootable_recovery-155cd3c155004433215147437cdf71844c9efd87.tar.gz
android_bootable_recovery-155cd3c155004433215147437cdf71844c9efd87.tar.bz2
android_bootable_recovery-155cd3c155004433215147437cdf71844c9efd87.tar.lz
android_bootable_recovery-155cd3c155004433215147437cdf71844c9efd87.tar.xz
android_bootable_recovery-155cd3c155004433215147437cdf71844c9efd87.tar.zst
android_bootable_recovery-155cd3c155004433215147437cdf71844c9efd87.zip
Diffstat (limited to 'recovery.c')
-rw-r--r--recovery.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/recovery.c b/recovery.c
index 06d649809..2cb482d02 100644
--- a/recovery.c
+++ b/recovery.c
@@ -39,6 +39,8 @@
#include "roots.h"
#include "recovery_ui.h"
+struct selabel_handle *sehandle;
+
static const struct option OPTIONS[] = {
{ "send_intent", required_argument, NULL, 's' },
{ "update_package", required_argument, NULL, 'u' },
@@ -132,7 +134,7 @@ fopen_path(const char *path, const char *mode) {
// When writing, try to create the containing directory, if necessary.
// Use generous permissions, the system (init.rc) will reset them.
- if (strchr("wa", mode[0])) dirCreateHierarchy(path, 0777, NULL, 1);
+ if (strchr("wa", mode[0])) dirCreateHierarchy(path, 0777, NULL, 1, sehandle);
FILE *fp = fopen(path, mode);
return fp;
@@ -763,6 +765,19 @@ main(int argc, char **argv) {
}
}
+#ifdef HAVE_SELINUX
+ struct selinux_opt seopts[] = {
+ { SELABEL_OPT_PATH, "/file_contexts" }
+ };
+
+ sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
+
+ if (!sehandle) {
+ fprintf(stderr, "Warning: No file_contexts\n");
+ ui_print("Warning: No file_contexts\n");
+ }
+#endif
+
device_recovery_start();
printf("Command:");