From dca12187f9b8d57bde73626f852423a58a93d0b9 Mon Sep 17 00:00:00 2001 From: "tachibana@mxm.nes.nec.co.jp" Date: Fri, 19 Nov 2010 17:08:21 +0900 Subject: [PATCH] cgred.in: fix return value start()/stop() function's 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 Signed-off-by: Jan Safranek --- scripts/init.d/cgred.in | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/init.d/cgred.in b/scripts/init.d/cgred.in index 784bddc1..0bea9e81 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 -- 2.47.2