fix blank ai_canonname from getaddrinfo for non-CNAMEs
[musl] / src / network / gethostbyname2.c
1 #define _GNU_SOURCE
2
3 #include <sys/socket.h>
4 #include <netdb.h>
5 #include <string.h>
6 #include <netinet/in.h>
7
8 struct hostent *gethostbyname2(const char *name, int af)
9 {
10         static struct hostent h;
11         static long buf[512/sizeof(long)];
12         struct hostent *res;
13         if (gethostbyname2_r(name, af, &h,
14                 (void *)buf, sizeof buf, &res, &h_errno)) return 0;
15         return &h;
16 }