DJ Lucas wrote:

> 
> Attached should be a
> working patch against lfs-bootscripts-3.2.2.  

And it really should have been attached.... :-)

-- DJ Lucas


--- lfs-bootscripts-3.2.2-orig/lfs/init.d/functions	2005-07-05 01:09:05.000000000 -0500
+++ lfs-bootscripts-3.2.2/lfs/init.d/functions	2005-08-08 19:56:14.000000000 -0500
@@ -426,7 +426,7 @@
 {
 	local pidfile=""
 	local lpids=""
-	local pidlist=""
+	pidlist=""
 	while true
 	do
 		case "${1}" in
@@ -455,20 +455,30 @@
 			return 3 # Program is not running
 		fi
 
-		lpids=`head -n 1 ${pidfile}`
-		for pid in ${lpids}
+		lpids=`head -n 1 "${pidfile}"`
+		for pid in "${lpids}"
 		do
 			if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
 				kill -0 "${pid}" > /dev/null &&
 				pidlist="${pidlist} ${pid}"
 			fi
-			echo ${pidlist}
-			test -z "${pidlist}" && return 1 # Program is dead, pidfile exists
-			return 0
 		done
+			# Check for compat flag.  If so, don't return anything, 
+			# else return pidlist
+			if [ -z "${GPCOMPAT}" ]; then
+				echo "${pidlist}"
+				test -z "${pidlist}" && 
+				return 1 # Program is dead, pidfile exists
+				return 0
+			fi
 
 	else
-		pidof -o $$ -o $PPID -x "${1}"
+		pidlist=`pidof -o "${$}" -o "${PPID}" -x "${1}"`
+		# Check for compat flag.  If so, don't return anything, 
+		# else return pidlist
+		if [ -z $GPCOMPAT ]; then
+			echo "${pidlist}"
+		fi
 	fi
 
 	if [ "$?" != "0" ]; then
@@ -479,10 +489,12 @@
 # This will ensure compatibility with previous LFS Bootscripts
 getpids()
 {
-	if [ -z "${PIDFILE}" ]; then
-		pidlist=`pidofproc -p "${PIDFILE}" [EMAIL PROTECTED]
+	# Use pidofproc now
+	GPCOMPAT=1
+	if [ -n "${PIDFILE}" ]; then
+		pidofproc -p "${PIDFILE}" "[EMAIL PROTECTED]"
 	else
-		pidlist=`pidofproc [EMAIL PROTECTED]
+		pidofproc "[EMAIL PROTECTED]"
 	fi
 	base="${1##*/}"
 }
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to