From 0d4f4bd9c3f7c83cbb78f70251c118325f1b65af Mon Sep 17 00:00:00 2001
From: Tommi Rantala <tt.rantala@gmail.com>
Date: Mon, 6 Jul 2009 11:53:02 +0300
Subject: [PATCH 17/25] fiu-run: POSIX preload library path fix

Always load the POSIX preload library from the library path defined
by -l, ignoring the order in which the parameters -l and -x were given.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
---
 preload/run/fiu-run.in |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/preload/run/fiu-run.in b/preload/run/fiu-run.in
index 11a5d87..4870097 100644
--- a/preload/run/fiu-run.in
+++ b/preload/run/fiu-run.in
@@ -17,6 +17,8 @@ ENABLE=""
 # additional preloader libraries to use
 PRELOAD_LIBS=""
 
+# use the POSIX preload library?
+USE_POSIX_PRELOAD=0
 
 HELP_MSG="
 Usage: fiu-run [options] program [arguments]
@@ -92,7 +94,7 @@ while getopts "+e:p:u:i:f:l:xh" opt; do
 		PLIBPATH="$OPTARG"
 		;;
 	x)
-		PRELOAD_LIBS="$PRELOAD_LIBS $PLIBPATH/fiu_posix_preload.so"
+		USE_POSIX_PRELOAD=1
 		;;
 	h|*)
 		echo "$HELP_MSG"
@@ -110,6 +112,10 @@ fi
 # eat the parameters we already processed
 shift $(( $OPTIND - 1 ))
 
+# Allow user to give -l and -x in any order.
+if [ $USE_POSIX_PRELOAD -eq 1 ] ; then
+	PRELOAD_LIBS="$PRELOAD_LIBS $PLIBPATH/fiu_posix_preload.so"
+fi
 
 #
 # Run the application
-- 
1.6.2.2.646.gb214

