[PATCH] init: avoid race between cat and killproc upon "service iwhd stop"

Pete Zaitcev zaitcev at redhat.com
Thu Feb 2 20:08:38 UTC 2012


* iwhd.init.in (stop): Cat the PID before calling killproc.
---
 iwhd.init.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/iwhd.init.in b/iwhd.init.in
index 2914a6f..809c121 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 2>/dev/null)
     if test $RETVAL = 0; then
         rm -f @localstatedir@/lock/subsys/$SERVICE
         rm -f $PIDFILE
--
1.7.9.112.gb85f2


More information about the iwhd-devel mailing list