Fix a problem in VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH)(): when removing the
added paths, it was taking out the colon between the removed entry and the
following, which meant the following was interpreted as having a big chunk of
whitespace at the start, which broke some things.
eg. was:
"foo:bar" --> " bar"
now:
"foo:bar" --> " :bar"
in which case " " is considered a separate path in it's own right, albeit one
that doesn't mean anything.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1779 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index 59c7385..9a71354 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -1697,7 +1697,7 @@
if (*p != ':') MUTANCY(2); /* skin.so entry must precede it */
coredir_first = p+1;
coredir_last = vg_prel - 1;
- coredir_len = coredir_last - coredir_first + 1;
+ coredir_len = coredir_last - coredir_first;
/* LD_PRELOAD: find "vgskin_foo.so" */
sk_prel = VG_(strstr)(ld_preload_str, "vgskin_");
@@ -1723,16 +1723,15 @@
p--;
}
/* Blank from "vgskin_" to next LD_PRELOAD entry (must be one, since
- the valgrind.so entry must follow) */
+ the valgrind.so entry must follow). But leave the colon. */
p = sk_prel;
while (*p != ':' && *p != '\0') {
*p = ' ';
p++;
}
if (*p == '\0') MUTANCY(7); /* valgrind.so has disappeared?! */
- *p = ' '; /* blank ending ':' */
- /* LD_LIBRARY_PATH: coredir --> blank */
+ /* LD_LIBRARY_PATH: coredir --> blank (but leave the colon) */
for (i = 0; i < coredir_len; i++)
pth_path[i] = ' ';