Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d831cd97 authored by Koushik K. Dutta's avatar Koushik K. Dutta Committed by Koushik Dutta
Browse files

adb shell should favor /sbin/sh if it exists. This lets you use adb shell from...

adb shell should favor /sbin/sh if it exists. This lets you use adb shell from recovery without using the /system/bin/sh and loading /system/lib/libc.so and leaving it in memory. This causes umount /system issues.
parent 2b1d0f7f
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -335,8 +335,10 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1


#if ADB_HOST
#if ADB_HOST
#define SHELL_COMMAND "/bin/sh"
#define SHELL_COMMAND "/bin/sh"
#define ALTERNATE_SHELL_COMMAND ""
#else
#else
#define SHELL_COMMAND "/system/bin/sh"
#define SHELL_COMMAND "/system/bin/sh"
#define ALTERNATE_SHELL_COMMAND "/sbin/sh"
#endif
#endif


int service_to_fd(const char *name)
int service_to_fd(const char *name)
@@ -394,8 +396,15 @@ int service_to_fd(const char *name)
        if(name[6]) {
        if(name[6]) {
            ret = create_subprocess(SHELL_COMMAND, "-c", name + 6);
            ret = create_subprocess(SHELL_COMMAND, "-c", name + 6);
        } else {
        } else {
            struct stat filecheck;
            ret = -1;
            if (stat(ALTERNATE_SHELL_COMMAND, &filecheck) == 0) {
                ret = create_subprocess(ALTERNATE_SHELL_COMMAND, "-", 0);
            }
            if (ret == -1) {
                ret = create_subprocess(SHELL_COMMAND, "-", 0);
                ret = create_subprocess(SHELL_COMMAND, "-", 0);
            }
            }
        }
#if !ADB_HOST
#if !ADB_HOST
    } else if(!strncmp(name, "sync:", 5)) {
    } else if(!strncmp(name, "sync:", 5)) {
        ret = create_service_thread(file_sync_service, NULL);
        ret = create_service_thread(file_sync_service, NULL);