aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-25 15:49:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-25 15:49:27 +0000
commit5eb9938636b0ef004df7038eeae4fa98c0cb208e (patch)
tree985c951545ec628357c6aee3d0c209fec63f0ae2
parent8881a3f927d65aa49ba81486f5fb78efafb090bd (diff)
downloadrspamd-5eb9938636b0ef004df7038eeae4fa98c0cb208e.tar.gz
rspamd-5eb9938636b0ef004df7038eeae4fa98c0cb208e.zip
Fix more issues
-rw-r--r--src/libutil/sqlite_utils.c2
-rw-r--r--src/lua/lua_sqlite3.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c
index 58abbc67a..270922eb6 100644
--- a/src/libutil/sqlite_utils.c
+++ b/src/libutil/sqlite_utils.c
@@ -298,7 +298,7 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const
rspamd_snprintf (lock_path, sizeof (lock_path), "%s.lock", path);
- if (access (path, R_OK) == -1 && create_sql != NULL) {
+ if (access (path, R_OK) == -1) {
flags |= SQLITE_OPEN_CREATE;
create = TRUE;
}
diff --git a/src/lua/lua_sqlite3.c b/src/lua/lua_sqlite3.c
index 708a74452..1f8eac143 100644
--- a/src/lua/lua_sqlite3.c
+++ b/src/lua/lua_sqlite3.c
@@ -99,16 +99,22 @@ lua_sqlite3_open (lua_State *L)
{
const gchar *path = luaL_checkstring (L, 1);
sqlite3 *db, **pdb;
+ GError *err = NULL;
if (path == NULL) {
lua_pushnil (L);
return 1;
}
- db = rspamd_sqlite3_open_or_create (NULL, path, NULL, NULL);
+ db = rspamd_sqlite3_open_or_create (NULL, path, NULL, &err);
if (db == NULL) {
+ if (err) {
+ msg_err ("cannot open db: %e", err);
+ g_error_free (err);
+ }
lua_pushnil (L);
+
return 1;
}