system(3) uses /bin/sh when built for host
/system/bin/sh exists only on Android. When Bionic is built for the
host, use the standard /bin/sh.
Bug: 159685774
Test: run aosp_cf_arm64_phone on rockpi4
Change-Id: Idf4028c134abc128f203fc4d3be591f06b8fe8ff
diff --git a/libc/bionic/__bionic_get_shell_path.cpp b/libc/bionic/__bionic_get_shell_path.cpp
index 7aeed18..c087b35 100644
--- a/libc/bionic/__bionic_get_shell_path.cpp
+++ b/libc/bionic/__bionic_get_shell_path.cpp
@@ -36,6 +36,10 @@
#define VENDOR_PREFIX "/vendor/"
static const char* init_sh_path() {
+#if !defined(__ANDROID__)
+ // For the host Bionic, use the standard /bin/sh
+ return "/bin/sh";
+#else
/* If the device is not treble enabled, return the path to the system shell.
* Vendor code, on non-treble enabled devices could use system() / popen()
* with relative paths for executables on /system. Since /system will not be
@@ -51,6 +55,7 @@
}
#endif
return "/system/bin/sh";
+#endif // if !defined(__ANDROID__)
}
const char* __bionic_get_shell_path() {