]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
Octets in an IPv4 address are unsigned
[user/henk/code/inspircd.git] / src / socket.cpp
index 00be4250bac0ac6030ddde5b271eab16045cad16..efe799bfc746f3436faa724172987e6bfd45a1a3 100644 (file)
@@ -27,10 +27,7 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten)
        sockaddrs servaddr;
        int ret;
 
-       if (*addr == '*' || *addr == '\0')
-               addr = NULL;
-
-       if (port == -1 && !addr)
+       if ((*addr == '*' || *addr == '\0') && port == -1)
        {
                /* Port -1: Means UDP IPV4 port binding - Special case
                 * used by DNS engine.
@@ -96,11 +93,11 @@ int irc::sockets::OpenTCPSocket(const std::string& addr, int socktype)
        }
        else
        {
-               setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+               setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on));
                /* This is BSD compatible, setting l_onoff to 0 is *NOT* http://web.irc.org/mla/ircd-dev/msg02259.html */
                linger.l_onoff = 1;
                linger.l_linger = 1;
-               setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger));
+               setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(linger));
                return (sockfd);
        }
 }
@@ -147,16 +144,16 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports)
                                }
                                if (!skip)
                                {
-                                       ClientListenSocket *ll = new ClientListenSocket(portno, Addr);
+                                       ClientListenSocket *ll = new ClientListenSocket(portno, Addr, "clients", *Desc ? Desc : "plaintext");
                                        if (ll->GetFd() > -1)
                                        {
                                                bound++;
-                                               ll->SetDescription(*Desc ? Desc : "plaintext");
                                                ports.push_back(ll);
                                        }
                                        else
                                        {
                                                failed_ports.push_back(std::make_pair(bind_readable, strerror(errno)));
+                                               delete ll;
                                        }
                                }
                        }