linker: log only real dlerrors

Currently linker reports all potential dlerrors
for example if library was not found in 'this'
namespace - it initializes linker error buffer
with not found message but when consequent
search in linked namespace succeeds this message
is droped because dlopen was successful.

This commit avoids logging false positive error
messages when debug.ld.* set to dlerror.

Test: manual
Change-Id: I480694a1b1bbacd6bd1d8505cd2ee491710964cc
This commit is contained in:
Dimitry Ivanov 2017-03-28 11:08:58 -07:00
parent 4b43140142
commit 11968b80af
2 changed files with 1 additions and 1 deletions

View file

@ -48,6 +48,7 @@ static char* __bionic_set_dlerror(char* new_value) {
char* old_value = *dlerror_slot; char* old_value = *dlerror_slot;
*dlerror_slot = new_value; *dlerror_slot = new_value;
LD_LOG(kLogErrors, "%s\n", new_value);
return old_value; return old_value;
} }

View file

@ -38,7 +38,6 @@
do { \ do { \
__libc_format_buffer(linker_get_error_buffer(), linker_get_error_buffer_size(), fmt, ##x); \ __libc_format_buffer(linker_get_error_buffer(), linker_get_error_buffer_size(), fmt, ##x); \
/* If LD_DEBUG is set high enough, log every dlerror(3) message. */ \ /* If LD_DEBUG is set high enough, log every dlerror(3) message. */ \
LD_LOG(kLogErrors, "%s\n", linker_get_error_buffer()); \
} while (false) } while (false)
#define DL_WARN(fmt, x...) \ #define DL_WARN(fmt, x...) \