Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jun 2017 12:07:33 +0000 (UTC)
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r442556 - in head/www/fcgiwrap: . files
Message-ID:  <201706041207.v54C7XPJ092703@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: matthew
Date: Sun Jun  4 12:07:33 2017
New Revision: 442556
URL: https://svnweb.freebsd.org/changeset/ports/442556

Log:
  Avoid accidentally killing init or other important processes when
  running 'service fcgiwrap onestop' if /var/run/fcgiwrap/fcgiwrap.pid
  doesn't exist or contain the fcgiwrap PID.
  
  This prevents killing any processes in process groups 0 or 1 or in the
  caller's process group if the rc script cannot read the fcgiwrap
  pidfile.
  
  PR:		219724
  Submitted by:	bblister@gmail.com
  MFH:		2017Q2

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

Modified: head/www/fcgiwrap/Makefile
==============================================================================
--- head/www/fcgiwrap/Makefile	Sun Jun  4 11:48:23 2017	(r442555)
+++ head/www/fcgiwrap/Makefile	Sun Jun  4 12:07:33 2017	(r442556)
@@ -2,7 +2,7 @@
 
 PORTNAME=	fcgiwrap
 PORTVERSION=	1.1.0
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	www
 
 MAINTAINER=	ports@FreeBSD.org

Modified: head/www/fcgiwrap/files/fcgiwrap.in
==============================================================================
--- head/www/fcgiwrap/files/fcgiwrap.in	Sun Jun  4 11:48:23 2017	(r442555)
+++ head/www/fcgiwrap/files/fcgiwrap.in	Sun Jun  4 12:07:33 2017	(r442556)
@@ -88,8 +88,10 @@ fcgiwrap_postcmd() {
 }
 
 fcgiwrap_stop() {
-	fcgiwrap_pgrp=$(/bin/ps -o ppid= $(cat ${pidfile}))
-	if [ -z "$fcgiwrap_pgrp" ] || ! kill -0 $fcgiwrap_pgrp; then
+	if [ -s ${pidfile} ]; then
+		fcgiwrap_pgrp=$(/bin/ps -o ppid= $(cat ${pidfile}))
+	fi
+	if [ -z "$fcgiwrap_pgrp" -o "${fcgiwrap_pgrp:-0}" -le 1 ] || ! kill -0 $fcgiwrap_pgrp; then
 		[ -n "$rc_fast" ] && return 0
 		_run_rc_notrunning
 		return 1



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