From 9935b4a0bbacc6dbaeb04f6aa17641f3c4c046da Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Mon, 20 Jun 2011 15:30:28 -0400
Subject: [PATCH] fixed valgrind attachment logic

---
 scripts/ost_config.in | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/scripts/ost_config.in b/scripts/ost_config.in
index e5e03634a..ed9faaaf3 100644
--- a/scripts/ost_config.in
+++ b/scripts/ost_config.in
@@ -36,18 +36,23 @@ export DNG_INITDIR="$DNG_LIBDIR/openstructure"
 #export QT_PLUGIN_PATH="$BIN_DIR/plugins"
 
 # retrieve absolute path to python executable
-pyexec=""
-if [ -z "$DNG_ATTACH_VALGRIND" ]; then
-  pyexec="@PYTHON_BINARY@"
-else
-  pyexec="valgrind --leak-check=full $pyexec"
-fi
+pyexec="@PYTHON_BINARY@"
 
-if [ ! -f "$pyexec" ]; then 
+if [ ! -x "$pyexec" ]; then 
   echo "Error: Python executable '$pyexec' not found!"
   exit
 fi
 
+
+if [ -n "$DNG_ATTACH_VALGRIND" ]; then
+  if [ ! -x `which valgrind` ]; then 
+    echo "Error: valgrind not found!"
+    exit
+  fi
+  pyexec="`which valgrind`#--leak-check=full#$pyexec"
+fi
+
+
 set -o noglob
 
 opts=""
-- 
GitLab