OSDN Git Service

Fix superuser when using ART.
authorKoushik Dutta <koushd@gmail.com>
Fri, 15 Nov 2013 17:24:32 +0000 (18:24 +0100)
committerKoushik Dutta <koushd@gmail.com>
Fri, 15 Nov 2013 17:24:32 +0000 (18:24 +0100)
Change-Id: I8ef488afe6f7912d8fac205088c3b431a5cb4a35

Superuser/jni/su/su.c

index 5451898..211b617 100644 (file)
@@ -631,12 +631,16 @@ int main(int argc, char *argv[]) {
 
     // attempt to use the daemon client if not root,
     // or this is api 18 and adb shell (/data is not readable even as root)
-    if ((geteuid() != AID_ROOT && getuid() != AID_ROOT) || (is_api_18() && getuid() == AID_SHELL)) {
-        // attempt to connect to daemon...
-        LOGD("starting daemon client %d %d", getuid(), geteuid());
-        return connect_daemon(argc, argv);
+    if (is_api_18()) {
+        if (geteuid() != AID_ROOT || getuid() != AID_ROOT) {
+            // attempt to connect to daemon...
+            LOGD("starting daemon client %d %d", getuid(), geteuid());
+            return connect_daemon(argc, argv);
+        }
     }
 
+    LOGD("skipping daemon client %d %d", getuid(), geteuid());
+
     // Sanitize all secure environment variables (from linker_environ.c in AOSP linker).
     /* The same list than GLibc at this point */
     static const char* const unsec_vars[] = {