Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 2017 16:54:40 +0000 (UTC)
From:      Adam Weinberger <adamw@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r441799 - in head/www/fcgiwrap: . files
Message-ID:  <201705261654.v4QGseaT013910@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adamw
Date: Fri May 26 16:54:40 2017
New Revision: 441799
URL: https://svnweb.freebsd.org/changeset/ports/441799

Log:
  Fix stale processes not being terminated by the rc(8) script.
  
  Previously, when fcgiwrap_flags="-c [n]" with n > 1, only the controlling
  process was terminated, with the children running. This patch fixes this
  behaviour, terminating the children.
  
  PR:		217297
  Submitted by:	lstewart
  Reported by:	spry anarchy in the ph
  MFH:		2017Q2

Modified:
  head/www/fcgiwrap/Makefile
  head/www/fcgiwrap/files/fcgiwrap.in

Modified: head/www/fcgiwrap/Makefile
==============================================================================
--- head/www/fcgiwrap/Makefile	Fri May 26 16:49:48 2017	(r441798)
+++ head/www/fcgiwrap/Makefile	Fri May 26 16:54:40 2017	(r441799)
@@ -2,7 +2,7 @@
 
 PORTNAME=	fcgiwrap
 PORTVERSION=	1.1.0
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	www
 
 MAINTAINER=	ports@FreeBSD.org

Modified: head/www/fcgiwrap/files/fcgiwrap.in
==============================================================================
--- head/www/fcgiwrap/files/fcgiwrap.in	Fri May 26 16:49:48 2017	(r441798)
+++ head/www/fcgiwrap/files/fcgiwrap.in	Fri May 26 16:54:40 2017	(r441799)
@@ -87,7 +87,18 @@ fcgiwrap_postcmd() {
 	fi
 }
 
-fcgiwrap_cleansocket() {
+fcgiwrap_stop() {
+	fcgiwrap_pgrp=$(/bin/ps -o ppid= $(cat ${pidfile}))
+	if [ -z "$fcgiwrap_pgrp" ] || ! kill -0 $fcgiwrap_pgrp; then
+		[ -n "$rc_fast" ] && return 0
+		_run_rc_notrunning
+		return 1
+	fi
+	fcgiwrap_pgrp_pids=$(/bin/pgrep -d ' ' -g ${fcgiwrap_pgrp})
+	echo "Stopping ${name}."
+	kill -TERM -- -${fcgiwrap_pgrp}
+	wait_for_pids ${fcgiwrap_pgrp_pids}
+
 	# Workaround the fact that fcgiwrap doesn't cleanup his socket at stopping
 	case ${fcgiwrap_socket} in 
 		unix*)
@@ -104,7 +115,7 @@ procname="%%PREFIX%%/sbin/${name}"
 command="/usr/sbin/daemon"
 start_precmd="fcgiwrap_precmd"
 start_postcmd="fcgiwrap_postcmd"
-stop_postcmd="fcgiwrap_cleansocket"
+stop_cmd="fcgiwrap_stop"
 
 load_rc_config $name
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705261654.v4QGseaT013910>