]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
cgred.in: fix return value start()/stop() function's
authortachibana@mxm.nes.nec.co.jp <tachibana@mxm.nes.nec.co.jp>
Fri, 19 Nov 2010 08:08:21 +0000 (17:08 +0900)
committerJan Safranek <jsafrane@redhat.com>
Wed, 15 Dec 2010 11:56:18 +0000 (12:56 +0100)
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 <tachibana@mxm.nes.nec.co.jp>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
scripts/init.d/cgred.in

index 784bddc1dec63f48dc2f5c574f83327a0dd8e3e7..0bea9e81ad28660d3c7628be68d7dee2650e4f04 100644 (file)
@@ -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