Merge "Remove default libraries"
diff --git a/reboot/reboot.c b/reboot/reboot.c
index f0cf40c..fe763a8 100644
--- a/reboot/reboot.c
+++ b/reboot/reboot.c
@@ -21,13 +21,13 @@
#include <cutils/android_reboot.h>
#include <unistd.h>
-int main(int argc, char *argv[])
-{
+int main(int argc, char* argv[]) {
int ret;
size_t prop_len;
char property_val[PROPERTY_VALUE_MAX];
- const char *cmd = "reboot";
- char *optarg = "";
+ static const char reboot[] = "reboot";
+ const char* cmd = reboot;
+ char* optarg = "";
opterr = 0;
do {
@@ -60,19 +60,23 @@
prop_len = snprintf(property_val, sizeof(property_val), "%s,%s", cmd, optarg);
if (prop_len >= sizeof(property_val)) {
- fprintf(stderr, "reboot command too long: %s\n", optarg);
+ fprintf(stderr, "%s command too long: %s\n", cmd, optarg);
exit(EXIT_FAILURE);
}
ret = property_set(ANDROID_RB_PROPERTY, property_val);
- if(ret < 0) {
- perror("reboot");
+ if (ret < 0) {
+ perror(cmd);
exit(EXIT_FAILURE);
}
// Don't return early. Give the reboot command time to take effect
// to avoid messing up scripts which do "adb shell reboot && adb wait-for-device"
- while(1) { pause(); }
+ if (cmd == reboot) {
+ while (1) {
+ pause();
+ }
+ }
fprintf(stderr, "Done\n");
return 0;
diff --git a/run-as/run-as.cpp b/run-as/run-as.cpp
index e7b8cc2..b27cfad 100644
--- a/run-as/run-as.cpp
+++ b/run-as/run-as.cpp
@@ -194,6 +194,7 @@
ScopedMinijail j(minijail_new());
minijail_change_uid(j.get(), uid);
minijail_change_gid(j.get(), gid);
+ minijail_keep_supplementary_gids(j.get());
minijail_enter(j.get());
if (selinux_android_setcontext(uid, 0, info.seinfo, pkgname) < 0) {