[Sanitizer] Don't die in symbolizer if it can't read /proc/self/exe link

llvm-svn: 179754
This commit is contained in:
Alexey Samsonov 2013-04-18 12:46:33 +00:00
parent 06022fc91a
commit d1efa5ef96
1 changed files with 6 additions and 1 deletions

View File

@ -148,7 +148,12 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) {
// First module is the binary itself.
uptr module_name_len = internal_readlink(
"/proc/self/exe", module_name.data(), module_name.size());
CHECK_NE(module_name_len, (uptr)-1);
if (module_name_len == (uptr)-1) {
// We can't read /proc/self/exe for some reason, assume the name of the
// binary is unknown.
module_name_len = internal_snprintf(module_name.data(),
module_name.size(), "/proc/self/exe");
}
CHECK_LT(module_name_len, module_name.size());
module_name[module_name_len] = '\0';
} else if (info->dlpi_name) {