mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Catch more PID path failures
This commit is contained in:
parent
2c7b16ed27
commit
47af739e47
1 changed files with 5 additions and 1 deletions
|
@ -330,11 +330,15 @@ USAGE_TEXT;
|
||||||
protected function resolvePID(string $pidfile): string {
|
protected function resolvePID(string $pidfile): string {
|
||||||
$dir = dirname($pidfile);
|
$dir = dirname($pidfile);
|
||||||
$file = basename($pidfile);
|
$file = basename($pidfile);
|
||||||
if ($base = @realpath($dir)) {
|
if (!strlen($file)) {
|
||||||
|
throw new \Exception("Specified PID file location must be a regular file");
|
||||||
|
} elseif ($base = @realpath($dir)) {
|
||||||
$out = "$base/$file";
|
$out = "$base/$file";
|
||||||
if (file_exists($out)) {
|
if (file_exists($out)) {
|
||||||
if (!is_writable($out)) {
|
if (!is_writable($out)) {
|
||||||
throw new \Exception("PID file is not writable");
|
throw new \Exception("PID file is not writable");
|
||||||
|
} elseif (!is_file($out)) {
|
||||||
|
throw new \Exception("Specified PID file location must be a regular file");
|
||||||
}
|
}
|
||||||
} elseif (!is_writable($base)) {
|
} elseif (!is_writable($base)) {
|
||||||
throw new \Exception("Cannot create PID file");
|
throw new \Exception("Cannot create PID file");
|
||||||
|
|
Loading…
Reference in a new issue