[PATCH] init: ignore cat failure upon "service stop iwhd" with no PID file
Pete Zaitcev
zaitcev at redhat.com
Thu Feb 2 20:04:07 UTC 2012
On Thu, 02 Feb 2012 19:03:04 +0100
Jim Meyering <jim at meyering.net> wrote:
> +++ b/iwhd.init.in
> @@ -101,7 +101,7 @@ start() {
> stop() {
> action $"Stopping $SERVICE daemon: " killproc -p $PIDFILE $PROCESS
> RETVAL=$?
> - pid=$(cat $PIDFILE)
> + pid=$(cat $PIDFILE 2>/dev/null)
> if test $RETVAL = 0; then
Would not it be well to move the cat up before action? This way
we would not race killproc, like this:
diff --git a/iwhd.init.in b/iwhd.init.in
index a82622e..bc46669 100644
--- a/iwhd.init.in
+++ b/iwhd.init.in
@@ -99,9 +99,9 @@ start() {
}
stop() {
+ pid=$(cat $PIDFILE 2>/dev/null)
action $"Stopping $SERVICE daemon: " killproc -p $PIDFILE $PROCESS
RETVAL=$?
- pid=$(cat $PIDFILE)
if test $RETVAL = 0; then
rm -f @localstatedir@/lock/subsys/$SERVICE
rm -f $PIDFILE
-- Pete
More information about the iwhd-devel
mailing list