]> PatchyGit - patchyircd.git/commitdiff
create_listen_sock: make sure we get a TCP socket
authorEgor <egor@patchysicp.xyz>
Thu, 27 Mar 2025 06:48:32 +0000 (08:48 +0200)
committerEgor <egor@patchysicp.xyz>
Thu, 27 Mar 2025 06:48:32 +0000 (08:48 +0200)
on netbsd, getaddrinfo returns SOCK_DGRAM first

src/main.cpp

index 70b0640..e0b3ccf 100644 (file)
@@ -28,6 +28,7 @@ static SOCKET create_listen_sock(const char *ip, const char *port)
        struct addrinfo hints, *res;
        memset(&hints, 0, sizeof(hints));
        hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
+       hints.ai_socktype = SOCK_STREAM;
        int err = getaddrinfo(ip, port, &hints, &res);
        if (err) {
                fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(err));