From 780d6777d20f8d97496c3fc248baeab9b41bebb4 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 13 Aug 2006 00:49:25 +0000 Subject: [PATCH] #bug 275 --- scripts/gpgcerts.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/gpgcerts.php b/scripts/gpgcerts.php index 43537ec..84c9eab 100755 --- a/scripts/gpgcerts.php +++ b/scripts/gpgcerts.php @@ -15,6 +15,10 @@ */ include_once("../includes/mysql.php"); + $lck = fopen('/tmp/GPGlock', 'w'); + while(flock($lck, LOCK_EX) < 0) + sleep(rand(100000,200000)); + $query = "select * from `gpg` where `crt`=''"; $res = mysql_query($query); while($row = mysql_fetch_assoc($res)) @@ -62,4 +66,7 @@ mysql_query($query); } } + + flock($lck, LOCK_UN); + fclose($lck); ?>