[PATCH] Fix getting environment variables for sanitizers needs on FreeBSD

Alexey Samsonov vonosmas at gmail.com
Tue Jun 24 00:05:28 PDT 2014


================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:325
@@ +324,3 @@
+  uptr NameLen = internal_strlen(name);
+  for (char **Env = ::environ; *Env != NULL; Env++) {
+    if (internal_strncmp(*Env, name, NameLen) == 0 && (*Env)[NameLen] == '=')
----------------
Ed Maste wrote:
> Note that ::environ may be null - see the libc implementation here:
> http://svnweb.freebsd.org/base/head/lib/libc/stdlib/getenv.c?revision=253413&view=markup#l428
> 
> 
Why can't you use internal_strstr function here?

http://reviews.llvm.org/D4229






More information about the llvm-commits mailing list