From 68ce0e3d710ea2b2d52ac524121ae1dd05fb6470 Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 27 Oct 2026 07:53:12 +0100 Subject: [PATCH] fix(chat): reject inconsistent repeated core initialization --- src/chat/chat_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chat/chat_core.c b/src/chat/chat_core.c index 82ad23a8f..8317df7ee 100644 --- a/src/chat/chat_core.c +++ b/src/chat/chat_core.c @@ -87,8 +87,8 @@ int chat_core_init(struct UTUN_INSTANCE* inst, const char* db_path) { } if (inst->chat_core) { - if (inst->chat_core->initialized) return 0; - DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "chat init: incomplete context already exists"); return -1; + if (inst->chat_core->initialized && inst->chat_core->db == inst->topo_sqlite_db && !strcmp(inst->chat_core->db_path, db_path)) return 0; + DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "chat init: incomplete context or different DB/path already exists"); return -1; } struct chat_core_ctx* cc = u_calloc(1, sizeof(*cc)); if (!cc) { DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "%s: OOM for chat_core_ctx", CC_ID); return -1; }