From 1d87b88c50d79021f90373b8b572b90048b8910a Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Wed, 26 Jun 2019 17:52:03 +0300 Subject: [PATCH] Avoid using sqlite3_errstr() The function is not in old SQLite3-versions such as the one used by Centos6. --- server/modules/monitor/clustrixmon/clustrixmonitor.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/modules/monitor/clustrixmon/clustrixmonitor.cc b/server/modules/monitor/clustrixmon/clustrixmonitor.cc index 2316988d8..b5e1c1e45 100644 --- a/server/modules/monitor/clustrixmon/clustrixmonitor.cc +++ b/server/modules/monitor/clustrixmon/clustrixmonitor.cc @@ -178,11 +178,16 @@ sqlite3* open_or_create_db(const std::string& path) } else { - MXS_ERROR("Opening/creating the sqlite3 database %s failed: %s", - path.c_str(), sqlite3_errstr(rv)); + if (pDb) + { + // Memory allocation failure is explained by the caller. Don't close the handle, as the + // caller will still use it even if open failed!! + MXS_ERROR("Opening/creating the sqlite3 database %s failed: %s", + path.c_str(), sqlite3_errmsg(pDb)); + } MXS_ERROR("Could not open sqlite3 database for storing information " "about dynamically detected Clustrix nodes. The Clustrix " - "monitor will remain dependant upon statically defined " + "monitor will remain dependent upon statically defined " "bootstrap nodes."); }