diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-09 19:12:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-09 19:12:21 +0100 |
commit | 9c19146f9b903aa0d1323faf58d920897ec61f72 (patch) | |
tree | 3b92274855d7276d832102aa62ccc4d323db118d /src | |
parent | 90f9eb98987b966a6e3465b6df5a4499ba175e6d (diff) | |
download | rspamd-9c19146f9b903aa0d1323faf58d920897ec61f72.tar.gz rspamd-9c19146f9b903aa0d1323faf58d920897ec61f72.zip |
Add additional check on open.
Issue: #331
Diffstat (limited to 'src')
-rw-r--r-- | src/libstat/backends/sqlite3_backend.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index 39934d44e..31b593c64 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -330,6 +330,13 @@ rspamd_sqlite3_opendb (const gchar *path, const ucl_object_t *opts, if (create) { flags |= SQLITE_OPEN_CREATE; } + else if (access (path, R_OK) == -1) { + g_set_error (err, rspamd_sqlite3_quark (), + errno, "cannot open sqlite file %s: %s", + path, strerror (errno)); + + return NULL; + } if ((rc = sqlite3_open_v2 (path, &sqlite, flags, NULL)) != SQLITE_OK) { |