From 31bcc59a86ac6d064b2dff307c822f2a3c48f40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 28 Jan 2023 14:11:57 +0100 Subject: [PATCH] Print database connection error that was previously unused The string copied into `aError` was previously unused because the function immediately returns. Now the error is logged to the console. --- src/engine/server/databases/connection_pool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/server/databases/connection_pool.cpp b/src/engine/server/databases/connection_pool.cpp index 8f575bd38..75fb1b2b5 100644 --- a/src/engine/server/databases/connection_pool.cpp +++ b/src/engine/server/databases/connection_pool.cpp @@ -432,12 +432,12 @@ void CWorker::Print(IConsole *pConsole, CDbConnectionPool::Mode DatabaseMode) /* static */ bool CDbConnectionPool::ExecSqlFunc(IDbConnection *pConnection, CSqlExecData *pData, Write w) { - char aError[256] = "error message not initialized"; if(pConnection == nullptr) { - str_format(aError, sizeof(aError), "No database given"); + dbg_msg("sql", "No database given"); return false; } + char aError[256] = "unknown error"; if(pConnection->Connect(aError, sizeof(aError))) { dbg_msg("sql", "failed connecting to db: %s", aError);