aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gruver <bgruv@google.com>2014-11-06 18:17:49 -0800
committerBen Gruver <bgruv@google.com>2014-11-06 23:03:46 -0800
commit20d4a3c2b4f37b2f50bb2163fa1476e0a75ce973 (patch)
tree412fea9ffe6d652f2cb2fc5d2db057154e0575b8
parente6423bd1e19b874ac225ba692c1302f58f0073d6 (diff)
downloadsmali-20d4a3c2b4f37b2f50bb2163fa1476e0a75ce973.tar.gz
Use dlerror() to clear any error before retrying with the mangled name
Thanks to Catalin Ontanu for reporting this, and then doing more investigation to find and test the solution.
-rw-r--r--deodexerant/deodexerant.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/deodexerant/deodexerant.c b/deodexerant/deodexerant.c
index e4b89a22..1cadee92 100644
--- a/deodexerant/deodexerant.c
+++ b/deodexerant/deodexerant.c
@@ -48,18 +48,20 @@ void main(int argc, char **argv) {
void *libdvm = dlopen("libdvm.so", RTLD_LAZY);
if (libdvm == NULL) {
- printf("Failed to load libdvm\n");
+ printf("Failed to load libdvm: %s\n", dlerror());
return;
}
dvmGetInlineOpsTablePtr dvmGetInlineOpsTable = dlsym(libdvm, "dvmGetInlineOpsTable");
if (dvmGetInlineOpsTable == NULL) {
+ // clear the error, and retry with the c++ mangled name
+ dlerror();
dvmGetInlineOpsTable = dlsym(libdvm, "_Z20dvmGetInlineOpsTablev");
}
if (dvmGetInlineOpsTable == NULL) {
- printf("Failed to load dvmGetInlineOpsTable\n");
+ printf("Failed to load dvmGetInlineOpsTable: %s\n", dlerror());
dlclose(libdvm);
return;
}
@@ -67,11 +69,13 @@ void main(int argc, char **argv) {
dvmGetInlineOpsTableLengthPtr dvmGetInlineOpsTableLength = dlsym(libdvm, "dvmGetInlineOpsTableLength");
if (dvmGetInlineOpsTableLength == NULL) {
+ // clear the error, and retry with the c++ mangled name
+ dlerror();
dvmGetInlineOpsTableLength = dlsym(libdvm, "_Z26dvmGetInlineOpsTableLengthv");
}
if (dvmGetInlineOpsTableLength == NULL) {
- printf("Failed to load dvmGetInlineOpsTableLength\n");
+ printf("Failed to load dvmGetInlineOpsTableLength: %s\n", dlerror());
dlclose(libdvm);
return;
}