]> git.wh0rd.org Git - tt-rss.git/commitdiff
make_lockfile: check if file was created successfully
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Feb 2013 17:28:51 +0000 (21:28 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Feb 2013 17:28:51 +0000 (21:28 +0400)
include/functions.php

index 2b7b7c586481ca9bea03d1c87af1e8f61bff5036..72d86e0a7c5be273be5aff1990950c8a271cce1a 100644 (file)
        function make_lockfile($filename) {
                $fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
 
-               if (flock($fp, LOCK_EX | LOCK_NB)) {
+               if ($fp && flock($fp, LOCK_EX | LOCK_NB)) {
                        if (function_exists('posix_getpid')) {
                                fwrite($fp, posix_getpid() . "\n");
                        }