diff options
Diffstat (limited to 'compiler-rt/lib/interception/interception_linux.cc')
-rw-r--r-- | compiler-rt/lib/interception/interception_linux.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/compiler-rt/lib/interception/interception_linux.cc b/compiler-rt/lib/interception/interception_linux.cc index 3c7e6edc44a..9f2caa25ca4 100644 --- a/compiler-rt/lib/interception/interception_linux.cc +++ b/compiler-rt/lib/interception/interception_linux.cc @@ -18,16 +18,27 @@ #include <dlfcn.h> // for dlsym() and dlvsym() +namespace __interception { + #if SANITIZER_NETBSD -#include "sanitizer_common/sanitizer_libc.h" +static int StrCmp(const char *s1, const char *s2) { + while (true) { + if (*s1 != *s2) + return false; + if (*s1 == 0) + return true; + s1++; + s2++; + } +} #endif -namespace __interception { bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, uptr real, uptr wrapper) { #if SANITIZER_NETBSD - // XXX: Find a better way to handle renames - if (internal_strcmp(func_name, "sigaction") == 0) func_name = "__sigaction14"; + // FIXME: Find a better way to handle renames + if (StrCmp(func_name, "sigaction")) + func_name = "__sigaction14"; #endif *func_addr = (uptr)dlsym(RTLD_NEXT, func_name); if (!*func_addr) { |