X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fdaemon.php;h=359a4343b5efc2a7a2e7f0557715b53dc1fecbcb;hb=2abe10b8ea4b5d69fc7f6513bf465541454ca2cf;hp=a7a49ce94bf769db86ad84bd2fb131886a0a7088;hpb=32a189220c1e7422dff591c8c8d5e8db04fcca83;p=quix0rs-gnu-social.git diff --git a/lib/daemon.php b/lib/daemon.php index a7a49ce94b..359a4343b5 100644 --- a/lib/daemon.php +++ b/lib/daemon.php @@ -28,6 +28,7 @@ class Daemon { function background() { $pid = pcntl_fork(); if ($pid < 0) { # error + common_log(LOG_ERR, "Could not fork."); return false; } else if ($pid > 0) { # parent common_log(LOG_INFO, "Successfully forked."); @@ -63,12 +64,15 @@ class Daemon { return false; } - file_put_contents($pidfilename, posix_getpid()); + return file_put_contents($pidfilename, posix_getpid() . "\n"); } function clearPidFile() { $pidfilename = $this->pidFilename(); - unlink($pidfilename); + if (!$pidfilename) { + return false; + } + return unlink($pidfilename); } function pidFilename() {