mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 23:52:51 +00:00
Adopted lwip_gethostbyname and lwip_gethostbyname_r to the new return values of dns_gethostbyname/netconn_gethostbyname
This commit is contained in:
parent
b3c52f574a
commit
9a524dac86
@ -1831,6 +1831,17 @@ lwip_gethostbyname(const char *name)
|
|||||||
err = netconn_gethostbyname(name, &addr);
|
err = netconn_gethostbyname(name, &addr);
|
||||||
if (err != ERR_OK) {
|
if (err != ERR_OK) {
|
||||||
LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err));
|
LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err));
|
||||||
|
switch(err) {
|
||||||
|
case ERR_MEM:
|
||||||
|
set_errno(ENOMEM);
|
||||||
|
break;
|
||||||
|
case ERR_ARG:
|
||||||
|
set_errno(EINVAL);
|
||||||
|
break;
|
||||||
|
/* case ERR_VAL: */
|
||||||
|
default:
|
||||||
|
set_errno(ENSRNOTFOUND);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1902,7 +1913,15 @@ lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
|
|||||||
err = netconn_gethostbyname(name, &(h->addr));
|
err = netconn_gethostbyname(name, &(h->addr));
|
||||||
if (err != ERR_OK) {
|
if (err != ERR_OK) {
|
||||||
LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err));
|
LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err));
|
||||||
return ENSRNOTFOUND;
|
switch(err) {
|
||||||
|
case ERR_MEM:
|
||||||
|
return ENOMEM;
|
||||||
|
case ERR_ARG:
|
||||||
|
return EINVAL;
|
||||||
|
/* case ERR_VAL: */
|
||||||
|
default:
|
||||||
|
return ENSRNOTFOUND;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the hostname into buf */
|
/* copy the hostname into buf */
|
||||||
|
Loading…
Reference in New Issue
Block a user