]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix a problem in VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH)(): when removing the
authorNicholas Nethercote <njn@valgrind.org>
Wed, 23 Jul 2003 09:22:02 +0000 (09:22 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 23 Jul 2003 09:22:02 +0000 (09:22 +0000)
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

coregrind/vg_main.c

index 59c738535c2ae4f4c9109e25b30d211c33886b90..9a71354ba9716e0b1f607b08a46d6e145cfd33ff 100644 (file)
@@ -1697,7 +1697,7 @@ void VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) ( Char* ld_preload_str,
    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 @@ void VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) ( Char* ld_preload_str,
       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] = ' ';