ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hopm/trunk/src/irc.c
(Generate patch)

Comparing hopm/trunk/src/irc.c (file contents):
Revision 5168 by michael, Fri Dec 26 19:31:53 2014 UTC vs.
Revision 5170 by michael, Fri Dec 26 20:53:09 2014 UTC

# Line 39 | Line 39
39   #include <sys/socket.h>
40   #include <netinet/in.h>
41   #include <arpa/inet.h>
42 #include <netdb.h>
42  
43   #ifdef TIME_WITH_SYS_TIME
44   # include <sys/time.h>
# Line 259 | Line 258 | irc_init(void)
258    /* Bind */
259    if (!EmptyString(IRCItem->vhost))
260    {
262    struct addrinfo hints, *res;
261      int bindret = 0;
262  
263 <    memset(&hints, 0, sizeof(hints));
266 <    hints.ai_family   = AF_INET;
267 <    hints.ai_socktype = SOCK_STREAM;
268 <    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
269 <
270 <    if (getaddrinfo(IRCItem->vhost, NULL, &hints, &res))
263 >    if (inet_pton(AF_INET, IRCItem->vhost, &(IRC_LOCAL.in4.s_addr)) <= 0)
264      {
265        log_printf("IRC -> bind(): %s is an invalid address", IRCItem->vhost);
266        exit(EXIT_FAILURE);
267      }
268  
276    memcpy(&IRC_LOCAL.in4.s_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof(struct in_addr));
277    freeaddrinfo(res);
278
269      bsaddr.sa4.sin_addr.s_addr = IRC_LOCAL.in4.s_addr;
270      bsaddr.sa4.sin_family = AF_INET;
271      bsaddr.sa4.sin_port = htons(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)