OSDN Git Service

fix possible fd leak, unrestored cancellation state on dns socket fail
[android-x86/external-musl-libc.git] / src / network / inet_legacy.c
index e802557..621b47b 100644 (file)
@@ -1,37 +1,14 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <stdio.h>
-#include "__dns.h"
-
-in_addr_t inet_addr(const char *p)
-{
-       struct sockaddr_in sin;
-       if (__ipparse(&sin, AF_INET, p)) return -1;
-       return sin.sin_addr.s_addr;
-}
 
 in_addr_t inet_network(const char *p)
 {
        return ntohl(inet_addr(p));
 }
 
-int inet_aton(const char *cp, struct in_addr *inp)
-{
-       return inet_pton(AF_INET, cp, (void *)inp) > 0;
-}
-
-char *inet_ntoa(struct in_addr in)
-{
-       static char buf[16];
-       unsigned char *a = (void *)&in;
-       snprintf(buf, sizeof buf, "%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
-       return buf;
-}
-
-struct in_addr inet_makeaddr(int net, int host)
+struct in_addr inet_makeaddr(in_addr_t n, in_addr_t h)
 {
-       uint32_t n = net, h = host;
        if (n < 256) h |= n<<24;
        else if (n < 65536) h |= n<<16;
        else h |= n<<8;