Fix service name to port resolution
This commit is contained in:
parent
bd0187a825
commit
d53f2baa3b
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue