From: Andrew Dolgov Date: Fri, 7 Jun 2013 05:39:12 +0000 (+0400) Subject: make_lockfile: check ino and dev fields for lock file (refs #703) X-Git-Tag: 1.8~17 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=58fc7095edfddc76100aacf6fb22dd6527c8a739;p=tt-rss.git make_lockfile: check ino and dev fields for lock file (refs #703) --- diff --git a/include/functions.php b/include/functions.php index 2f288737..87917a5c 100644 --- a/include/functions.php +++ b/include/functions.php @@ -992,6 +992,13 @@ $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"); }