Commit 4b83810d authored by Niels Möller's avatar Niels Möller

* io.c (get_inaddr): Use the protocol argument.

* io.c (get_inaddr): use symbolic constant to check inet_addr
result; fixes name resolving on Linux/Alpha.

Rev: src/io.c:1.37
parent 7a817028
...@@ -480,7 +480,7 @@ get_inaddr(struct sockaddr_in * addr, ...@@ -480,7 +480,7 @@ get_inaddr(struct sockaddr_in * addr,
{ {
/* First check for numerical ip-number */ /* First check for numerical ip-number */
addr->sin_addr.s_addr = inet_addr(host); addr->sin_addr.s_addr = inet_addr(host);
if (addr->sin_addr.s_addr == (unsigned long)-1) if (addr->sin_addr.s_addr == INADDR_NONE)
{ {
struct hostent * hp; struct hostent * hp;
...@@ -512,7 +512,7 @@ get_inaddr(struct sockaddr_in * addr, ...@@ -512,7 +512,7 @@ get_inaddr(struct sockaddr_in * addr,
{ {
struct servent * serv; struct servent * serv;
serv = getservbyname(service, "tcp"); serv = getservbyname(service, protocol);
if (serv == NULL) if (serv == NULL)
return 0; return 0;
addr->sin_port = serv->s_port; addr->sin_port = serv->s_port;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment