Add checking of return status of sqlite3_open_v2() to ensure we are not trying to use the database when it failed to open (e.g., when it does not exist).
Errors on development-v6:
2024-06-06 06:48:34.042 CEST [2901888/T2901896] ERROR: SQLite3: cannot open file at line 44775 of [96c92aba00] (14)
2024-06-06 06:48:34.042 CEST [2901888/T2901896] ERROR: SQLite3: os_unix.c:44775: (0) open(/etc/pihole/gravity.db) - (14)
2024-06-06 06:48:34.042 CEST [2901888/T2901896] ERROR: SQLite3: API call with unopened database connection pointer (21)
2024-06-06 06:48:34.042 CEST [2901888/T2901896] ERROR: SQLite3: misuse at line 142653 of [96c92aba00] (21)
2024-06-06 06:48:34.042 CEST [2901888/T2901896] WARNING: gravity_updated(): SELECT value FROM info WHERE property = 'updated'; - SQL error prepare: bad parameter or other API misuse
Errors on this branch:
2024-06-06 06:47:53.012 CEST [2901383/T2901392] ERROR: Cannot read gravity database at /etc/pihole/gravity.db - file does not exist or is not readable
Note that FTL works flawlessly (in terms of DNS resolution, but obviously without any blocking when gravity.db is missing) on either branch. This is merely cosmetic.
Related issue or feature (if applicable): N/A
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
I have commented my proposed changes within the code.
I am willing to help maintain this change if there are issues with it later.
What does this implement/fix?
Add checking of return status of
sqlite3_open_v2()
to ensure we are not trying to use the database when it failed to open (e.g., when it does not exist).Errors on
development-v6
:Errors on this branch:
Note that FTL works flawlessly (in terms of DNS resolution, but obviously without any blocking when
gravity.db
is missing) on either branch. This is merely cosmetic.Related issue or feature (if applicable): N/A
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
git rebase
)Checklist:
developmental
branch.