This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d59a9ea189 inet_addr: return INADDR_NONE(-1) when input string is
invalid
d59a9ea189 is described below
commit d59a9ea189b88229c942d81508f806435374453e
Author: zhanghongyu <[email protected]>
AuthorDate: Fri May 5 21:52:24 2023 +0800
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 <[email protected]>
---
libs/libc/net/lib_inetaddr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/libc/net/lib_inetaddr.c b/libs/libc/net/lib_inetaddr.c
index 1b6db62bc4..146ee68916 100644
--- a/libs/libc/net/lib_inetaddr.c
+++ b/libs/libc/net/lib_inetaddr.c
@@ -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))
{