From 7b5beabceb3ae644acf793a249bbf564faf1ebe6 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 2 Nov 2013 04:07:12 -0400 Subject: fix regression in inet_aton due to misinterpretation of __ipparse return inet_aton returns a boolean success value, whereas __ipparse returns 0 on success and -1 on failure. also change the conditional in inet_addr to be consistent with other uses of __ipparse where only negative values are treated as failure. --- src/network/inet_legacy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/network/inet_legacy.c') diff --git a/src/network/inet_legacy.c b/src/network/inet_legacy.c index dd75420e..0a0ad6fc 100644 --- a/src/network/inet_legacy.c +++ b/src/network/inet_legacy.c @@ -11,9 +11,9 @@ in_addr_t inet_network(const char *p) int inet_aton(const char *cp, struct in_addr *inp) { struct sockaddr_in sin; - int r = __ipparse(&sin, AF_INET, cp); + if (__ipparse(&sin, AF_INET, cp) < 0) return 0; *inp = sin.sin_addr; - return r; + return 1; } struct in_addr inet_makeaddr(int net, int host) -- cgit v1.2.1