Now cgred script can't return proper value. Because
stop()/start() functions return result of if [] when failing,
and result of wrong commands when succeeding.

So fix this.

Signed-off-by: Masaki Tachibana <[email protected]>
---
 scripts/init.d/cgred.in |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/scripts/init.d/cgred.in b/scripts/init.d/cgred.in
index c05ddf0..b3846a0 100644
--- a/scripts/init.d/cgred.in
+++ b/scripts/init.d/cgred.in
@@ -89,8 +89,12 @@ start()
        if [ $RETVAL -ne 0 ]; then
                return 7
        fi
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
+       touch /var/lock/subsys/$servicename
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
        echo "`pidof $processname`" > $pidfile
+       return 0
 }
 
 stop()
@@ -103,10 +107,12 @@ stop()
        killproc -p $pidfile $processname -TERM
        RETVAL=$?
        echo
-       if [ $RETVAL -eq 0 ] ; then
-               rm -f /var/lock/subsys/$servicename
-               rm -f $pidfile
+       if [ $RETVAL -ne 0 ] ; then
+               return 1
        fi
+       rm -f /var/lock/subsys/$servicename
+       rm -f $pidfile
+       return 0
 }
 
 # See how we are called
-- 
1.7.2.3


------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages, 
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev 
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to