]> git.wh0rd.org - tt-rss.git/blobdiff - include/functions.php
make_lockfile: check ino and dev fields for lock file (refs #703)
[tt-rss.git] / 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");
                        }