summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2012-03-31 05:48:34 +0200
committerKenny Root <kroot@google.com>2012-03-31 06:26:01 +0200
commit41dda82d847ae8c261b09c383806b412d680f935 (patch)
tree98edeec4fa5d9df2d0104624d66b1608cecdaf50 /recovery.cpp
parentMerge "fail edify script if set_perm() or symlink() fails" (diff)
parentam 155cd3c1: Merge changes Ied379f26,I09fb9d56 (diff)
downloadandroid_bootable_recovery-41dda82d847ae8c261b09c383806b412d680f935.tar
android_bootable_recovery-41dda82d847ae8c261b09c383806b412d680f935.tar.gz
android_bootable_recovery-41dda82d847ae8c261b09c383806b412d680f935.tar.bz2
android_bootable_recovery-41dda82d847ae8c261b09c383806b412d680f935.tar.lz
android_bootable_recovery-41dda82d847ae8c261b09c383806b412d680f935.tar.xz
android_bootable_recovery-41dda82d847ae8c261b09c383806b412d680f935.tar.zst
android_bootable_recovery-41dda82d847ae8c261b09c383806b412d680f935.zip
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 726442b84..baafadca0 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -45,6 +45,8 @@ extern "C" {
#include "minadbd/adb.h"
}
+struct selabel_handle *sehandle;
+
static const struct option OPTIONS[] = {
{ "send_intent", required_argument, NULL, 's' },
{ "update_package", required_argument, NULL, 'u' },
@@ -138,7 +140,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;
@@ -803,6 +805,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->StartRecovery();
printf("Command:");