Fix fork/exec stuff so it works again.  We have to mangle LD_LIBRARY_PATH
as well as LD_PRELOAD, so as to make our libpthread.so go out of scope
when a child which we don't want to trace, is exec'd.  Otherwise the
child can wind up being connected to our libpthread.so but not to
valgrind.so, which is an unworkable combination; you have to be connected
to both or neither.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@291 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/valgrind.in b/coregrind/valgrind.in
index 3d12fe1..b316a74 100755
--- a/coregrind/valgrind.in
+++ b/coregrind/valgrind.in
@@ -165,12 +165,17 @@
    exit 1
 fi
 
+# A bit subtle.  The LD_PRELOAD added entry must be absolute
+# and not depend on LD_LIBRARY_PATH.  This is so that we can
+# mess with LD_LIBRARY_PATH for child processes, which makes
+# libpthread.so fall out of visibility, independently of
+# whether valgrind.so is visible.
 
 VG_ARGS="$VALGRIND_OPTS $vgsupp $vgopts"
 export VG_ARGS
 LD_LIBRARY_PATH=$VALGRIND:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
-LD_PRELOAD=valgrind.so:$LD_PRELOAD
+LD_PRELOAD=$VALGRIND/valgrind.so:$LD_PRELOAD
 export LD_PRELOAD
 #LD_DEBUG=files
 #LD_DEBUG=symbols