Fix service name to port resolution

This commit is contained in:
Přemysl Eric Janouch 2014-08-17 17:50:25 +02:00
parent bd0187a825
commit d53f2baa3b
1 changed files with 1 additions and 1 deletions

View File

@ -995,7 +995,7 @@ socks_connect (const char *socks_host, const char *socks_port,
unsigned long port_no;
const struct servent *serv;
if ((serv = getservbyname (port, "tcp")))
port_no = (uint16_t) serv->s_port;
port_no = (uint16_t) ntohs (serv->s_port);
else if (!xstrtoul (&port_no, port, 10) || !port_no || port_no > UINT16_MAX)
{
error_set (e, "invalid port number");