summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-11-02 04:07:12 -0400
committerRich Felker <dalias@aerifal.cx>2013-11-02 04:07:12 -0400
commit7b5beabceb3ae644acf793a249bbf564faf1ebe6 (patch)
tree19705c6b4c1118a10123787f3add7dee46fb8b63 /src
parentf9fb20b42da0e755d93de229a5a737d79a0e8f60 (diff)
downloadmusl-7b5beabceb3ae644acf793a249bbf564faf1ebe6.tar.gz
musl-7b5beabceb3ae644acf793a249bbf564faf1ebe6.tar.bz2
musl-7b5beabceb3ae644acf793a249bbf564faf1ebe6.tar.xz
musl-7b5beabceb3ae644acf793a249bbf564faf1ebe6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/network/inet_addr.c2
-rw-r--r--src/network/inet_legacy.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/network/inet_addr.c b/src/network/inet_addr.c
index 84137281..ea0a8f7a 100644
--- a/src/network/inet_addr.c
+++ b/src/network/inet_addr.c
@@ -6,6 +6,6 @@
in_addr_t inet_addr(const char *p)
{
struct sockaddr_in sin;
- if (__ipparse(&sin, AF_INET, p)) return -1;
+ if (__ipparse(&sin, AF_INET, p) < 0) return -1;
return sin.sin_addr.s_addr;
}
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)