OSDN Git Service

Fix Superuser on 64 bits target lollipop-x86
authorPaulo Sergio Travaglia <pstglia@gmail.com>
Fri, 16 Oct 2015 11:23:27 +0000 (08:23 -0300)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 16 Oct 2015 15:12:47 +0000 (23:12 +0800)
 - An export to "/system/lib" is not required and cause problems
   as this is a 32 bits lib dir only
 - When writing to socket, datatype size_t was used, which is
   4 bytes on 32 bits target and 8 bytes on 64 bits.
   Superuser expects it as a 4 bytes length. So, it was
   replaced by "uint32_t" datatype

Superuser/jni/su/su.c

index f27d656..be25e7e 100644 (file)
@@ -367,7 +367,7 @@ static int socket_accept(int serv_fd) {
 static int socket_send_request(int fd, const struct su_context *ctx) {
 #define write_data(fd, data, data_len)              \
 do {                                                \
-    size_t __len = htonl(data_len);                 \
+    uint32_t __len = htonl(data_len);               \
     __len = write((fd), &__len, sizeof(__len));     \
     if (__len != sizeof(__len)) {                   \
         PLOGE("write(" #data ")");                  \
@@ -680,12 +680,6 @@ int su_main(int argc, char *argv[], int need_client) {
         cp++;
     }
 
-    /*
-     * set LD_LIBRARY_PATH if the linker has wiped out it due to we're suid.
-     * This occurs on Android 4.0+
-     */
-    setenv("LD_LIBRARY_PATH", "/vendor/lib:/system/lib", 0);
-
     LOGD("su invoked.");
 
     struct su_context ctx = {