aboutsummaryrefslogtreecommitdiffstats
path: root/www/fcgiwrap
diff options
context:
space:
mode:
authormatthew <matthew@FreeBSD.org>2017-06-04 20:07:33 +0800
committermatthew <matthew@FreeBSD.org>2017-06-04 20:07:33 +0800
commit2e8b3dec9cc439ddf039a95848db131b94b1f5d5 (patch)
tree9dcc7781fb0445c2f8a9730e0ad46475a14f2acf /www/fcgiwrap
parent85a794597dbd254d0f203c3f49925668f5558d5c (diff)
downloadfreebsd-ports-gnome-2e8b3dec9cc439ddf039a95848db131b94b1f5d5.tar.gz
freebsd-ports-gnome-2e8b3dec9cc439ddf039a95848db131b94b1f5d5.tar.zst
freebsd-ports-gnome-2e8b3dec9cc439ddf039a95848db131b94b1f5d5.zip
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
Diffstat (limited to 'www/fcgiwrap')
-rw-r--r--www/fcgiwrap/Makefile2
-rw-r--r--www/fcgiwrap/files/fcgiwrap.in6
2 files changed, 5 insertions, 3 deletions
diff --git a/www/fcgiwrap/Makefile b/www/fcgiwrap/Makefile
index 54f20c2f53f4..cb3ef2286ee0 100644
--- a/www/fcgiwrap/Makefile
+++ b/www/fcgiwrap/Makefile
@@ -2,7 +2,7 @@
PORTNAME= fcgiwrap
PORTVERSION= 1.1.0
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= www
MAINTAINER= ports@FreeBSD.org
diff --git a/www/fcgiwrap/files/fcgiwrap.in b/www/fcgiwrap/files/fcgiwrap.in
index daa165490606..92f172780718 100644
--- a/www/fcgiwrap/files/fcgiwrap.in
+++ b/www/fcgiwrap/files/fcgiwrap.in
@@ -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