]> git.wh0rd.org Git - tt-rss.git/commitdiff
make_lockfile: check ino and dev fields for lock file (refs #703)
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 7 Jun 2013 05:39:12 +0000 (09:39 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 7 Jun 2013 05:39:12 +0000 (09:39 +0400)
include/functions.php

index 2f288737ed4b6814ead1331889807107deccacfb..87917a5cb345428a599e44e1500d8ba0a86409e7 100644 (file)
                $fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
 
                if ($fp && flock($fp, LOCK_EX | LOCK_NB)) {
+                       $stat_h = fstat($fp);
+                       $stat_f = stat(LOCK_DIRECTORY . "/$filename");
+
+                       if ($stat_h["ino"] != $stat_f["ino"] || $stat_h["dev"] != $stat_f["dev"]) {
+                               return false;
+                       }
+
                        if (function_exists('posix_getpid')) {
                                fwrite($fp, posix_getpid() . "\n");
                        }