Commit b8c9eb47 authored by Franco Fichtner's avatar Franco Fichtner

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).
parent 844d6b50
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment