diff options
author | jim-p <jimp@pfsense.org> | 2015-07-30 11:34:24 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2015-07-30 11:34:42 -0400 |
commit | 6b8ad2daafc2e60de6e27400173251657c3ef4af (patch) | |
tree | a8bbfbedbf70a35e87b8091ca1b7bb2a72d46d8e | |
parent | ff5464544d8be3d662fd3e42a0b51708e78d67b6 (diff) | |
download | pfsense-6b8ad2daafc2e60de6e27400173251657c3ef4af.zip pfsense-6b8ad2daafc2e60de6e27400173251657c3ef4af.tar.gz |
More safety belts on CP DB open
-rw-r--r-- | etc/inc/captiveportal.inc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 460263d..baf8bee 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -1414,6 +1414,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."); |