diff --git a/src/Common/Config/configReadClient.cpp b/src/Common/Config/configReadClient.cpp index 8ce2a8b03e9..70886f2aa92 100644 --- a/src/Common/Config/configReadClient.cpp +++ b/src/Common/Config/configReadClient.cpp @@ -10,14 +10,25 @@ namespace DB { bool configReadClient(Poco::Util::LayeredConfiguration & config, const std::string & home_path) { + auto safe_exists = [](const auto & path)->bool + { + std::error_code ec; + bool res = fs::exists(path, ec); + if (ec.value() > 0) + { + LOG_ERROR(&Poco::Logger::get("ClickHouseClient"), "Can't check '{}': [{}]({})", path, ec.value(), ec.message()); + } + return res; + }; + std::string config_path; if (config.has("config-file")) config_path = config.getString("config-file"); - else if (fs::exists("./clickhouse-client.xml")) + else if (safe_exists("./clickhouse-client.xml")) config_path = "./clickhouse-client.xml"; - else if (!home_path.empty() && fs::exists(home_path + "/.clickhouse-client/config.xml")) + else if (!home_path.empty() && safe_exists(home_path + "/.clickhouse-client/config.xml")) config_path = home_path + "/.clickhouse-client/config.xml"; - else if (fs::exists("/etc/clickhouse-client/config.xml")) + else if (safe_exists("/etc/clickhouse-client/config.xml")) config_path = "/etc/clickhouse-client/config.xml"; if (!config_path.empty())