mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
inet_addr: return INADDR_NONE(-1) when input string is invalid
now:
inet_network("300.10.10.10"); return 0
inet_addr("300.10.10.10"); return 0
glibc and muscle both return INADDR_NONE or -1.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -88,7 +88,7 @@ in_addr_t inet_addr(FAR const char *cp)
|
||||
unsigned int b;
|
||||
unsigned int c;
|
||||
unsigned int d;
|
||||
uint32_t result = 0;
|
||||
uint32_t result = INADDR_NONE;
|
||||
|
||||
switch (sscanf(cp, "%u.%u.%u.%u", &a, &b, &c, &d))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user