From: Vsevolod Stakhov Date: Mon, 25 Jan 2016 15:49:27 +0000 (+0000) Subject: Fix more issues X-Git-Tag: 1.1.2~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5eb9938636b0ef004df7038eeae4fa98c0cb208e;p=thirdparty%2Frspamd.git Fix more issues --- diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c index 58abbc67a0..270922eb64 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 708a744525..1f8eac1439 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; }