From b3890d78c0d3c2f1f851330bff1fcf68deb4b325 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 11 Sep 2009 21:30:19 -0400 Subject: Lock around read call --- usr/local/www/status_captiveportal.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr/local/www/status_captiveportal.php') diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index ab0e20d..7a66011 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -61,10 +61,13 @@ function clientcmp($a, $b) { } $cpdb = array(); -if (file_exists("{$g['vardb_path']}/captiveportal.db")) - $cpcontents = file("{$g['vardb_path']}/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); -else +if (file_exists("{$g['vardb_path']}/captiveportal.db")) { + $captiveportallck = lock('captiveportal'); + $cpcontents = file("/var/db/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + unlock($captiveportallck); +} else { $cpcontents = array(); +} $concurrent = count($cpcontents); -- cgit v1.1