summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Yun <justinyun@google.com>2017-05-31 07:09:20 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-31 07:09:20 +0000
commitc35bdcf5ef9ba5d07ab43645e790e4c2248f1079 (patch)
treed0a6a4ff04ca18177ae36358e8d796e03bb69925
parentd1451e1d3315e311b22a47503c3766888c96edb4 (diff)
parenta6ff1a46987a138fd611f25d15022eb06e2bdaaf (diff)
downloadlibhardware-c35bdcf5ef9ba5d07ab43645e790e4c2248f1079.tar.gz
libhardware: load with dlopen if the library is in system.
am: a6ff1a4698 Change-Id: I234995fca08e058318c500314cbed230cdaeb480
-rw-r--r--hardware.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hardware.c b/hardware.c
index 37b61c44..8faac074 100644
--- a/hardware.c
+++ b/hardware.c
@@ -82,7 +82,14 @@ static int load(const char *id,
* dlopen returns. Since RTLD_GLOBAL is not or'd in with
* RTLD_NOW the external symbols will not be global
*/
- handle = android_load_sphal_library(path, RTLD_NOW);
+ if (strncmp(path, "/system/", 8) == 0) {
+ /* If the library is in system partition, no need to check
+ * sphal namespace. Open it with dlopen.
+ */
+ handle = dlopen(path, RTLD_NOW);
+ } else {
+ handle = android_load_sphal_library(path, RTLD_NOW);
+ }
if (handle == NULL) {
char const *err_str = dlerror();
ALOGE("load: module=%s\n%s", path, err_str?err_str:"unknown");