diff options
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/socket.cpp | 4 | ||||
-rw-r--r-- | win/inspircd_win32wrapper.h | 8 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 8bc3bfd9c..21251983c 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -203,12 +203,14 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) return; } +#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)) ipvalid = false; } +#endif if (x->IPAddr.find(':') != std::string::npos) { in6_addr n; diff --git a/src/socket.cpp b/src/socket.cpp index 1d1103235..5827b8b77 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -93,6 +93,7 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports) continue; } +#ifndef _WIN32 // Are we creating a UNIX listener? const std::string path = tag->getString("path"); if (!path.empty()) @@ -109,13 +110,14 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports) // Create the bindspec manually (aptosa doesn't work with AF_UNIX yet). memset(&bindspec, 0, sizeof(bindspec)); bindspec.un.sun_family = AF_UNIX; - stpncpy(bindspec.un.sun_path, path.c_str(), sizeof(bindspec.un.sun_path) - 1); + memcpy(&bindspec.un.sun_path, path.c_str(), sizeof(bindspec.un.sun_path)); if (!BindPort(tag, bindspec, old_ports)) failed_ports.push_back(std::make_pair(bindspec, errno)); else bound++; } +#endif } std::vector<ListenSocket*>::iterator n = ports.begin(); diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h index 8b418928d..a6ca0da6e 100644 --- a/win/inspircd_win32wrapper.h +++ b/win/inspircd_win32wrapper.h @@ -198,3 +198,11 @@ inline ssize_t writev(int fd, const WindowsIOVec* iov, int count) return sent; return -1; } + +// This wrapper is just so we don't need to do #ifdef _WIN32 everywhere in the socket code. It is +// not actually used and does not need to be the same size as sockaddr_un on UNIX systems. +struct sockaddr_un +{ + ADDRESS_FAMILY sun_family; + char sun_path[6]; +}; |