mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
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).
This commit is contained in:
parent
844d6b506a
commit
b8c9eb4711
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user