git » libfiu » commit 0d4f4bd

fiu-run: POSIX preload library path fix

author Tommi Rantala
2009-07-06 08:53:02 UTC
committer Alberto Bertogli
2009-07-06 13:50:35 UTC
parent 3921b80255f8f1a25ae64f75e1aa48d48780a87b

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 +7 -1

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