--- dcbd-0.9.19/dcbd.init.orig 2010-02-24 13:29:02.601535935 +0100 +++ dcbd-0.9.19/dcbd.init 2010-02-24 14:06:57.155690681 +0100 @@ -151,6 +151,7 @@ # See how we were called. case "$1" in start) + [ "$EUID" = "0" ] || exit 4 if ! /sbin/lsmod | grep dcbnl > /dev/null; then mod_dir="/lib/modules/$(uname -r)/kernel/net/dcb" if [ -f $mod_dir/dcbnl.ko ]; then @@ -163,6 +164,7 @@ [ $? -eq 0 ] && touch /var/lock/subsys/dcbd ;; stop) + [ "$EUID" = "0" ] || exit 4 echo -n $"Shutting down $DCBD: " killproc $DCBD rc_status -v @@ -185,6 +187,14 @@ checkproc $DCBD_BIN # NOTE: rc_status knows that we called this init script with # "status" option and adapts its messages accordingly. + RC=$? + if [ "$RC" = "3" -a -f /var/lock/subsys/dcbd ]; then + rc_failed 2 + elif [ "$RC" = "3" ]; then + rc_failed 3 + elif [ "$RC" = "1" ]; then + rc_failed 1 + fi rc_status -v ;; try-restart|condrestart) @@ -242,9 +252,13 @@ rc_failed 3 rc_status -v ;; + usage) + echo $"Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 0 + ;; *) echo $"Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 + exit 2 esac rc_exit