From 33932b95e4b886aec8ac1bf3e3e1665826bcd0ea Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 29 May 2019 12:48:05 +0100 Subject: Add irc::sockets::isunix for checking if a file is a UNIX socket. --- src/modules/m_spanningtree/main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 44271473c..55fe992b6 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -191,11 +191,9 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) } irc::sockets::sockaddrs sa; -#ifndef _WIN32 if (x->IPAddr.find('/') != std::string::npos) { - struct stat sb; - if (stat(x->IPAddr.c_str(), &sb) == -1 || !S_ISSOCK(sb.st_mode) || !irc::sockets::untosa(x->IPAddr, sa)) + if (!irc::sockets::isunix(x->IPAddr) || !irc::sockets::untosa(x->IPAddr, sa)) { // We don't use the family() != AF_UNSPEC check below for UNIX sockets as // that results in a DNS lookup. @@ -205,7 +203,6 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) } } else -#endif { // If this fails then the IP sa will be AF_UNSPEC. irc::sockets::aptosa(x->IPAddr, x->Port, sa); -- cgit v1.2.3