From 0e18b9daafdb07bd68bb18bfbb35952fafaeb06d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 17 Jun 2024 16:58:10 +0100 Subject: Fix directory includes to always be in a consistent order. --- src/configparser.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/configparser.cpp b/src/configparser.cpp index 224170bff..36d8e3dad 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -389,6 +389,7 @@ void ParseStack::DoInclude(const std::shared_ptr& tag, int flags) flags |= FLAG_NO_ENV; const std::string includedir = ServerInstance->Config->Paths.PrependConfig(name); + std::set configs; try { for (const auto& entry : std::filesystem::directory_iterator(includedir)) @@ -397,17 +398,20 @@ void ParseStack::DoInclude(const std::shared_ptr& tag, int flags) continue; const std::string path = entry.path().string(); - if (!InspIRCd::Match(path, "*.conf")) - continue; - - if (!ParseFile(path, flags, mandatorytag)) - throw CoreException("Included"); + if (InspIRCd::Match(path, "*.conf")) + configs.insert(path); } } catch (const std::filesystem::filesystem_error& err) { throw CoreException("Unable to read directory for include " + includedir + ": " + err.what()); } + + for (const auto& config : configs) + { + if (!ParseFile(config, flags, mandatorytag)) + throw CoreException("Included"); + } } else if (tag->readString("executable", name)) -- cgit v1.3.1-10-gc9f91