]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/valgrind/src/valgrind-3.6.0-svn/coregrind/m_libcproc.c
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / coregrind / m_libcproc.c
index 5b3a33ba8d47a5c6dc897528d2e84c47f1506d11..1ac94ec2dba7ac3c751487cae4d1ad683dc0c4ba 100644 (file)
@@ -69,6 +69,15 @@ Char** VG_(client_envp) = NULL;
 /* Path to library directory */
 const Char *VG_(libdir) = VG_LIBDIR;
 
+const Char *VG_(LD_PRELOAD_var_name) =
+#if defined(VGO_linux) || defined(VGO_aix5) || defined(VGO_l4re)
+   "LD_PRELOAD";
+#elif defined(VGO_darwin)
+   "DYLD_INSERT_LIBRARIES";
+#else
+#  error Unknown OS
+#endif
+
 /* We do getenv without libc's help by snooping around in
    VG_(client_envp) as determined at startup time. */
 Char *VG_(getenv)(Char *varname)
@@ -187,9 +196,13 @@ static void mash_colon_env(Char *varp, const Char *remove_pattern)
            entry_start = output+1;     /* entry starts after ':' */
       }
 
-      *output++ = *varp++;
+      if (*varp)
+         *output++ = *varp++;
    }
 
+   /* make sure last entry is nul terminated */
+   *output = '\0';
+
    /* match against the last entry */
    if (VG_(string_match)(remove_pattern, entry_start)) {
       output = entry_start;