From b8c9eb4711c2e1b7edf43b231b4bb4716fbfd354 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 3 Mar 2017 21:02:22 +0100 Subject: [PATCH] util: dear future reader, don't try to kill init this way The chances that this gets fed a garbage value has potential to be close to 1, but we are quite fond of our little init so if this is needed do it the manual way (as it is already done, at least for HUP). --- src/etc/inc/util.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 7964c3fb4..a3452bddc 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -43,7 +43,7 @@ function killbypid($pidfile, $sig = 'TERM', $waitforit = false) { if (isvalidpid($pidfile)) { mwexecf('/bin/pkill -%s -F %s', array($sig, $pidfile)); - } elseif (is_numeric($pidfile) && $pidfile > 0) { + } elseif (is_numeric($pidfile) && $pidfile > 1) { mwexecf('/bin/kill -%s %s', array($sig, $pidfile)); } else { return; @@ -62,7 +62,7 @@ function isvalidpid($pidfile) { if (file_exists($pidfile)) { return mwexecf('/bin/pgrep -nF %s', $pidfile, true) == 0; - } elseif (is_numeric($pidfile) && $pidfile > 0) { + } elseif (is_numeric($pidfile) && $pidfile > 1) { return mwexecf('/bin/kill -0 %s', $pidfile, true) == 0; }