Merge "use /system/bin/sh for all" into main am: 79434542bc
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2969412 Change-Id: I229fe068b9a9d2a3c571d1f33c77536af0f6e8ba Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
caeb54a332
1 changed files with 1 additions and 19 deletions
|
@ -28,29 +28,11 @@
|
|||
|
||||
#include "private/__bionic_get_shell_path.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define VENDOR_PREFIX "/vendor/"
|
||||
|
||||
static const char* init_sh_path() {
|
||||
const char* __bionic_get_shell_path() {
|
||||
#if !defined(__ANDROID__)
|
||||
// For the host Bionic, use the standard /bin/sh
|
||||
return "/bin/sh";
|
||||
#else
|
||||
// Look for /system or /vendor prefix.
|
||||
char exe_path[strlen(VENDOR_PREFIX)];
|
||||
ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path));
|
||||
if (len != -1 && !strncmp(exe_path, VENDOR_PREFIX, strlen(VENDOR_PREFIX))) {
|
||||
return "/vendor/bin/sh";
|
||||
}
|
||||
return "/system/bin/sh";
|
||||
#endif // if !defined(__ANDROID__)
|
||||
}
|
||||
|
||||
const char* __bionic_get_shell_path() {
|
||||
static const char* sh_path = init_sh_path();
|
||||
return sh_path;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue