Skip to content

Commit

Permalink
Fixed appPidLocation check according to bug 20062 (PEAR)
Browse files Browse the repository at this point in the history
System_Daemon requires that pidfiles live in their own directories, like `/var/run/appName/pidfile` instead of `/var/run/appName.pid`. This is conform to the policies of most Linux distributions about `/var/run/`.

However, the existing check failed to allow locations like `/dir/appName/pidfile` or `./appName/pidfile` as it was required that the path component of `appPidLocation` requires at least three nested directories like `/var/run/appName/..`

This commit fixes this.

A further improvement might be to perform the check only if the pidfile should being placed in `/var/run/` in order to allow `./pidfile` for example.
  • Loading branch information
metashock committed Oct 9, 2013
1 parent 9069e2f commit b8141de
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions System/Daemon.php
Expand Up @@ -1452,9 +1452,7 @@ static protected function _isValidPidLocation($pidFilePath, $log = true)
);
}

$pidDirPath = dirname($pidFilePath);
$parts = explode('/', $pidDirPath);
if (count($parts) <= 3 || end($parts) != self::opt('appName')) {
if(basename(dirname($pidFilePath)) !== self::opt('appName')) {
// like: /var/run/x.pid
return self::err(
'Since version 0.6.3, the pidfile needs to be ' .
Expand Down

0 comments on commit b8141de

Please sign in to comment.