use /system/bin/sh for all
Since Treble, /vendor components has been using /vendor/bin/sh. But this
gets complicated with APEXes, /odm, apps, etc. We now switch back to
/system/bin/sh for all domains. In practice, this should be okay because
/system/bin/sh is almost stable.
Bug: 324142245
Test: system("readlink /proc/$$/exe") in vendor components
Change-Id: Id830aa8281e7cbda1f15474174c38d8e28dc358b
diff --git a/libc/bionic/__bionic_get_shell_path.cpp b/libc/bionic/__bionic_get_shell_path.cpp
index b78aede..5d22e00 100644
--- a/libc/bionic/__bionic_get_shell_path.cpp
+++ b/libc/bionic/__bionic_get_shell_path.cpp
@@ -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;
-}