From a3e7c015f7a001db50d960202ee11ec838ca5113 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Tue, 27 Sep 2011 16:16:15 +0200 Subject: [PATCH] Exit code is not properly returned when using RUN_AS_USER (from http://jira.codehaus.org/browse/MAPPASM-113 ) --- sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh | 3 ++- sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh | 3 ++- sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh | 3 ++- .../src/main/assembly/bin/macosx-universal-32/sonar.sh | 3 ++- .../src/main/assembly/bin/macosx-universal-64/sonar.sh | 3 ++- .../src/main/assembly/bin/solaris-sparc-32/sonar.sh | 3 ++- .../src/main/assembly/bin/solaris-sparc-64/sonar.sh | 3 ++- .../src/main/assembly/bin/solaris-x86-32/sonar.sh | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh b/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh index c080399c62c..aa02bd87032 100755 --- a/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh @@ -334,6 +334,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -349,7 +350,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } diff --git a/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh b/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh index c080399c62c..aa02bd87032 100755 --- a/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh @@ -334,6 +334,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -349,7 +350,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } diff --git a/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh b/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh index c080399c62c..aa02bd87032 100755 --- a/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh @@ -334,6 +334,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -349,7 +350,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } diff --git a/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh b/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh index 6ad48536cc5..525cf6053ee 100755 --- a/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh @@ -334,6 +334,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -349,7 +350,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } diff --git a/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh b/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh index 6ad48536cc5..525cf6053ee 100755 --- a/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh @@ -334,6 +334,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -349,7 +350,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } diff --git a/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh b/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh index 154e3289218..b7ea5df58b6 100755 --- a/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh @@ -335,6 +335,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -350,7 +351,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } diff --git a/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh b/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh index 154e3289218..b7ea5df58b6 100755 --- a/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh @@ -335,6 +335,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -350,7 +351,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } diff --git a/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh b/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh index 98ba3efd301..8848cfa9ba5 100755 --- a/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh @@ -334,6 +334,7 @@ checkUser() { # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 sudo -u $RUN_AS_USER "$REALPATH" "$2" + RETVAL=$? # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] @@ -349,7 +350,7 @@ checkUser() { fi fi - exit 0 + exit $RETVAL fi } -- 2.39.5