aboutsummaryrefslogtreecommitdiffstats
path: root/libc/upstream-openbsd/android/include/openbsd-compat.h
diff options
context:
space:
mode:
authorSandeep Patil <sspatil@google.com>2017-08-21 12:17:19 -0700
committerSandeep Patil <sspatil@google.com>2017-08-22 10:17:28 -0700
commit9b1ca569db3e698c3a901720ae6989c876a9e6ee (patch)
tree586e7581ad2e2296aa8b24cb4c5bcf598255bfbb /libc/upstream-openbsd/android/include/openbsd-compat.h
parent611d0de62fc7d23dcdd120c2d3698acc85351f9e (diff)
downloadandroid_bionic-9b1ca569db3e698c3a901720ae6989c876a9e6ee.tar.gz
android_bionic-9b1ca569db3e698c3a901720ae6989c876a9e6ee.tar.bz2
android_bionic-9b1ca569db3e698c3a901720ae6989c876a9e6ee.zip
libc: Add support to allow library calls to find appropriate shell executable for a process
Library calls like system() and popen() invoke the shell executable pointed to by '_PATH_BSHELL' in order to run the command passed into the function. The _PATH_BSHELL points to /system/bin/sh by default and thus breaks any vendor process trying to use system() / popen(), as they are denied access to system shell by selinux. This CL make necessary changes, so the implmentations of system() and popen() can use the appropriate shell (e.g. /vendor/bin/sh for processes running out of /vendor partition). Also, changes the implementation of system() and popen(). Bug: 64832610 Test: Manual, Using a test program running from /system/bin and /vendor/bin to ensure correct shell is being used. Change-Id: Ie7168d69decb1ae98284446ae7db34dec930dc33 Merged-In: Ie7168d69decb1ae98284446ae7db34dec930dc33 Signed-off-by: Sandeep Patil <sspatil@google.com> (cherry picked from commit aa3e32422cc7089b9b15976f2651a58840d95e4f)
Diffstat (limited to 'libc/upstream-openbsd/android/include/openbsd-compat.h')
-rw-r--r--libc/upstream-openbsd/android/include/openbsd-compat.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index baf505723..d83143583 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -71,6 +71,10 @@ extern const char* __progname;
*/
#define _PATH_TMP "/data/local/tmp/"
+/* Use appropriate shell depending on process's executable. */
+__LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
+#define _PATH_BSHELL __bionic_get_shell_path()
+
/* We have OpenBSD's getentropy_linux.c, but we don't mention getentropy in any header. */
__LIBC_HIDDEN__ extern int getentropy(void*, size_t);