SOURCES: squid.init - removed dead loop (I hope)

hawk hawk at pld-linux.org
Mon Sep 5 22:39:27 CEST 2005


Author: hawk                         Date: Mon Sep  5 20:39:27 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- removed dead loop (I hope)

---- Files affected:
SOURCES:
   squid.init (1.38 -> 1.39) 

---- Diffs:

================================================================
Index: SOURCES/squid.init
diff -u SOURCES/squid.init:1.38 SOURCES/squid.init:1.39
--- SOURCES/squid.init:1.38	Mon Sep  5 11:25:58 2005
+++ SOURCES/squid.init	Mon Sep  5 22:39:22 2005
@@ -41,6 +41,9 @@
 # Get service config
 [ -f /etc/sysconfig/squid ] && . /etc/sysconfig/squid
 
+# Set default shutdown timeout if it is not set in service config
+SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-60}
+
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
 	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
@@ -86,11 +89,14 @@
 		if [ ! $PID -eq 0 ]; then
 			show "Waiting for Squid to stop"
 			busy
-			# FIXME: DEADLOOP!
-			# redirect_program could stay lingering around and this loop is never breaken
+			timeout=0
 			while ps -U squid -o user | grep -q ^squid
 			do
+				if [ $timeout -ge $SQUID_SHUTDOWN_TIMEOUT ]; then
+				    break
+				fi
 				sleep 1
+				timeout=$((timeout+1))
 			done
 			ok
 		fi
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/squid.init?r1=1.38&r2=1.39&f=u




More information about the pld-cvs-commit mailing list