Ticket #373: net-tcpserver.cc.patch

File net-tcpserver.cc.patch, 728 bytes (added by Olly Betts, 16 years ago)

Patch which might help

  • net/tcpserver.cc

     
    167167    }
    168168
    169169    struct sockaddr_in addr;
    170     addr.sin_family = AF_INET;
    171170    addr.sin_port = htons(port);
    172171    if (host.empty()) {
     172        addr.sin_family = AF_INET;
    173173        addr.sin_addr.s_addr = INADDR_ANY;
    174174    } else {
    175175        // FIXME: timeout on gethostbyname() ?
     
    191191                );
    192192        }
    193193
    194         memcpy(&addr.sin_addr, hostent->h_addr, sizeof(addr.sin_addr));
     194        addr.sin_family = hostent->h_addrtype;
     195        memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
     196        memcpy(&addr.sin_addr, hostent->h_addr, hostent->h_length);
    195197    }
    196198
    197199    retval = bind(socketfd,