aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-01-16 22:54:02 +0000
committerGravatar Sadie Powell2023-01-16 22:54:02 +0000
commit612e1a30274bf4e239077f63a877440eb134da4d (patch)
tree77402bfa73ce247460a6613de28a393dde2122f6
parentFix some testing changes that snuck in to the previous commit. (diff)
Store the actual error in FailedPort instead of an error code.
-rw-r--r--include/socket.h8
-rw-r--r--src/configreader.cpp2
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/socket.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/include/socket.h b/include/socket.h
index ea5b37ea0..6d7cee958 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -159,15 +159,15 @@ namespace irc
struct CoreExport FailedPort final
{
/** The error which happened during binding. */
- int error;
+ const std::string error;
/** The endpoint on which we were attempting to bind. */
- irc::sockets::sockaddrs sa;
+ const irc::sockets::sockaddrs sa;
/** The config tag that the listener was created from. */
- std::shared_ptr<ConfigTag> tag;
+ const std::shared_ptr<ConfigTag> tag;
- FailedPort(int err, irc::sockets::sockaddrs& addr, const std::shared_ptr<ConfigTag>& cfg)
+ FailedPort(const std::string& err, irc::sockets::sockaddrs& addr, const std::shared_ptr<ConfigTag>& cfg)
: error(err)
, sa(addr)
, tag(cfg)
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 7556aab97..baa109d05 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -434,7 +434,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string& useruid)
errstr << "Warning! Some of your listener" << (pl.size() == 1 ? "s" : "") << " failed to bind:" << std::endl;
for (const auto& fp : pl)
{
- errstr << " " << fp.sa.str() << ": " << strerror(fp.error) << std::endl
+ errstr << " " << fp.sa.str() << ": " << fp.error << std::endl
<< " " << "Created from <bind> tag at " << fp.tag->source.str() << std::endl;
}
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 7774965fc..e7b6257bd 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -378,7 +378,7 @@ namespace
for (const auto& fp : pl)
{
- std::cout << " " << rang::style::bold << fp.sa.str() << rang::style::reset << ": " << strerror(fp.error) << '.' << std::endl
+ std::cout << " " << rang::style::bold << fp.sa.str() << rang::style::reset << ": " << fp.error << '.' << std::endl
<< " " << "Created from <bind> tag at " << fp.tag->source.str() << std::endl
<< std::endl;
}
diff --git a/src/socket.cpp b/src/socket.cpp
index 05b94de8b..171f7368a 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -108,7 +108,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports)
continue;
if (!BindPort(tag, bindspec, old_ports, protocol))
- failed_ports.emplace_back(errno, bindspec, tag);
+ failed_ports.emplace_back(strerror(errno), bindspec, tag);
else
bound++;
}
@@ -141,7 +141,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports)
bindspec.from_unix(fullpath);
if (!BindPort(tag, bindspec, old_ports, 0))
- failed_ports.emplace_back(errno, bindspec, tag);
+ failed_ports.emplace_back(strerror(errno), bindspec, tag);
else
bound++;
}