dlerror returns char*, not const char*.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlerror.html:
char *dlerror(void);
...
The application shall not modify the string returned.
Change-Id: I5e684bfd3930c39a2a30ea6fd005a5d5d3e5b181
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 4d9a218..3ac61d7 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -33,10 +33,10 @@
static pthread_mutex_t g_dl_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-static const char* __bionic_set_dlerror(char* new_value) {
+static char* __bionic_set_dlerror(char* new_value) {
char** dlerror_slot = &reinterpret_cast<char**>(__get_tls())[TLS_SLOT_DLERROR];
- const char* old_value = *dlerror_slot;
+ char* old_value = *dlerror_slot;
*dlerror_slot = new_value;
return old_value;
}
@@ -52,8 +52,8 @@
__bionic_set_dlerror(buffer);
}
-const char* dlerror() {
- const char* old_value = __bionic_set_dlerror(nullptr);
+char* dlerror() {
+ char* old_value = __bionic_set_dlerror(nullptr);
return old_value;
}