]> source.dussan.org Git - rspamd.git/commitdiff
Fix more issues
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 25 Jan 2016 15:49:27 +0000 (15:49 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 25 Jan 2016 15:49:27 +0000 (15:49 +0000)
src/libutil/sqlite_utils.c
src/lua/lua_sqlite3.c

index 58abbc67a06545ec82d9594691bfd880a20f31ba..270922eb6459b85cb52cb4fb9a2149ac522f9025 100644 (file)
@@ -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;
        }
index 708a74452504abce6bf2af4f56025056fad4dc38..1f8eac1439945ae2d9add45bc4f73ea7575bd0e1 100644 (file)
@@ -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;
        }