diff --git a/src/topo_group.c b/src/topo_group.c index 192f8d56..96e9406f 100644 --- a/src/topo_group.c +++ b/src/topo_group.c @@ -254,15 +254,17 @@ struct TOPO_GROUPS* topo_groups_init(struct UTUN_INSTANCE* instance) { g->v6_subnet_pool = memory_pool_init(sizeof(struct TOPO_SUBNET6), "to_v6sub"); if (instance->config && instance->config->global.db_path[0]) { - int rc = sqlite3_open(instance->config->global.db_path, &instance->topo_sqlite_db); + char db_file[512]; + snprintf(db_file, sizeof(db_file), "%s/chats.db", instance->config->global.db_path); + int rc = sqlite3_open(db_file, &instance->topo_sqlite_db); if (rc == SQLITE_OK && instance->topo_sqlite_db) { sqlite3_exec(instance->topo_sqlite_db, "PRAGMA journal_mode=WAL", NULL, NULL, NULL); sqlite3_exec(instance->topo_sqlite_db, "PRAGMA foreign_keys=ON", NULL, NULL, NULL); topo_node_sqlite_init(instance->topo_sqlite_db); - DEBUG_INFO(DEBUG_CATEGORY_BGP, "SQLite opened: %s", instance->config->global.db_path); + DEBUG_INFO(DEBUG_CATEGORY_BGP, "SQLite opened: %s", db_file); } else { DEBUG_ERROR(DEBUG_CATEGORY_BGP, "sqlite3_open(%s) failed: %s", - instance->config->global.db_path, instance->topo_sqlite_db ? sqlite3_errmsg(instance->topo_sqlite_db) : "null db"); + db_file, instance->topo_sqlite_db ? sqlite3_errmsg(instance->topo_sqlite_db) : "null db"); if (instance->topo_sqlite_db) { sqlite3_close(instance->topo_sqlite_db); instance->topo_sqlite_db = NULL; } } } diff --git a/tools/chatgui/transport/chat_core.c b/tools/chatgui/transport/chat_core.c index 607df578..a3012ad0 100644 --- a/tools/chatgui/transport/chat_core.c +++ b/tools/chatgui/transport/chat_core.c @@ -105,7 +105,6 @@ int chat_core_init(struct UTUN_INSTANCE* inst, const char* db_path) { g_cc.my_node_id = inst->node_id; topo_node_sqlite_init(g_cc.db); - inst->topo_sqlite_db = g_cc.db; /* записать себя в nodes + local_identity с реальным node_id и именем */ {