From: Nicholas Nethercote Date: Wed, 23 Jul 2003 09:22:02 +0000 (+0000) Subject: Fix a problem in VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH)(): when removing the X-Git-Tag: svn/VALGRIND_2_0_0~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa19839b93b1dd77394e6f562ab0d110b532afdc;p=thirdparty%2Fvalgrind.git 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 --- diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 59c738535c..9a71354ba9 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -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] = ' ';