Skip to content

Instantly share code, notes, and snippets.

@bkerler
Forked from ganadist/adb.patch
Created April 21, 2014 12:07
Show Gist options
  • Save bkerler/11140919 to your computer and use it in GitHub Desktop.
Save bkerler/11140919 to your computer and use it in GitHub Desktop.
diff --git a/adb/Android.mk b/adb/Android.mk
index 721b48d..fef1bef 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -123,6 +123,7 @@ LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
endif
+LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
LOCAL_MODULE := adbd
diff --git a/adb/adb.c b/adb/adb.c
index 72b7484..c10b23c 100644
--- a/adb/adb.c
+++ b/adb/adb.c
@@ -1194,7 +1194,7 @@ static void drop_capabilities_bounding_set_if_needed() {
#ifdef ALLOW_ADBD_ROOT
char value[PROPERTY_VALUE_MAX];
property_get("ro.debuggable", value, "");
- if (strcmp(value, "1") == 0) {
+ if (1 || strcmp(value, "1") == 0) {
return;
}
#endif
@@ -1235,7 +1235,7 @@ static int should_drop_privileges() {
// ... except we allow running as root in userdebug builds if the
// service.adb.root property has been set by the "adb root" command
property_get("ro.debuggable", value, "");
- if (strcmp(value, "1") == 0) {
+ if (1 || strcmp(value, "1") == 0) {
property_get("service.adb.root", value, "");
if (strcmp(value, "1") == 0) {
secure = 0;
diff --git a/adb/services.c b/adb/services.c
index 951048e..cc1793d 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -68,7 +68,7 @@ void restart_root_service(int fd, void *cookie)
adb_close(fd);
} else {
property_get("ro.debuggable", value, "");
- if (strcmp(value, "1") != 0) {
+ if (0 && strcmp(value, "1") != 0) {
snprintf(buf, sizeof(buf), "adbd cannot run as root in production builds\n");
writex(fd, buf, strlen(buf));
adb_close(fd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment