summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2015-07-30 11:34:24 -0400
committerjim-p <jimp@pfsense.org>2015-07-30 11:34:24 -0400
commit0351eef8b07071b176187ee8f236685740e5d920 (patch)
tree1c081cb91651704faf8effbae5d6430329358d34 /etc
parentbda867db4de3ff882eca9223e0f5ad93753354f4 (diff)
downloadpfsense-0351eef8b07071b176187ee8f236685740e5d920.zip
pfsense-0351eef8b07071b176187ee8f236685740e5d920.tar.gz
More safety belts on CP DB open
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/captiveportal.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index f9aba8c..4b6e56a 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1344,6 +1344,19 @@ function captiveportal_opendb() {
"CREATE INDEX IF NOT EXISTS ip ON captiveportal (ip); " .
"CREATE INDEX IF NOT EXISTS starttime ON captiveportal (allow_time)";
+ try {
+ $DB = new SQLite3($db_path);
+ } catch (Exception $e) {
+ captiveportal_syslog("Could not open {$db_path} as an sqlite database for {$cpzone}. Error message: " . $e->getMessage() . " -- Trying again.");
+ unlink_if_exists($db_path);
+ try {
+ $DB = new SQLite3($db_path);
+ } catch (Exception $e) {
+ captiveportal_syslog("Still could not open {$db_path} as an sqlite database for {$cpzone}. Error message: " . $e->getMessage() . " -- Remove the database file manually and ensure there is enough free space.");
+ return;
+ }
+ }
+
$DB = new SQLite3($db_path);
if (!$DB) {
captiveportal_syslog("Could not open {$db_path} as an sqlite database for {$cpzone}. Error message: {$DB->lastErrorMsg()}. Trying again.");
OpenPOWER on IntegriCloud