From: tachibana@mxm.nes.nec.co.jp Date: Fri, 19 Nov 2010 08:08:21 +0000 (+0900) Subject: cgred.in: fix return value start()/stop() function's X-Git-Tag: v0.37.1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dca12187f9b8d57bde73626f852423a58a93d0b9;p=thirdparty%2Flibcgroup.git 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 --- 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