Ignore the first dlpi entry which is ourselves on NetBSD instead of having

a NULL name as on linux.
This commit is contained in:
christos 2016-06-01 00:53:35 +00:00
parent bafdaf94ba
commit 97989743a7
1 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,15 @@ static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size,
if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
return 0;
#if SANITIZER_NETBSD
// Ignore first entry (the main program)
char **p = (char **)data;
if (*p == NULL) {
*p = (char *)-1;
return 0;
}
#endif
*(const char **)data = info->dlpi_name;
return 1;
}