miniupnpc: Fix checking for inet_pton() errors
inet_pton() indicates error by zero or negative return value.
This commit is contained in:
parent
9ef311d235
commit
0d5b416e05
|
@ -62,7 +62,7 @@ int addr_is_reserved(const char * addr_str)
|
|||
return 1;
|
||||
#else
|
||||
/* was : addr_n = inet_addr(addr_str); */
|
||||
if (inet_pton(AF_INET, addr_str, &addr_n) < 0) {
|
||||
if (inet_pton(AF_INET, addr_str, &addr_n) <= 0) {
|
||||
/* error */
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -716,7 +716,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||
#endif
|
||||
#else
|
||||
/* was : mc_if.s_addr = inet_addr(multicastif); */ /* ex: 192.168.x.x */
|
||||
if (inet_pton(AF_INET, multicastif, &mc_if.s_addr) < 0) {
|
||||
if (inet_pton(AF_INET, multicastif, &mc_if.s_addr) <= 0) {
|
||||
mc_if.s_addr = INADDR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue