summaryrefslogtreecommitdiff
path: root/src/network/gethostbyaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/gethostbyaddr.c')
-rw-r--r--src/network/gethostbyaddr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/network/gethostbyaddr.c b/src/network/gethostbyaddr.c
new file mode 100644
index 00000000..51e1c569
--- /dev/null
+++ b/src/network/gethostbyaddr.c
@@ -0,0 +1,15 @@
+#define _GNU_SOURCE
+
+#include <netdb.h>
+#include <string.h>
+#include <netinet/in.h>
+
+struct hostent *gethostbyaddr(const void *a, socklen_t l, int af)
+{
+ static struct hostent h;
+ static long buf[512/sizeof(long)];
+ struct hostent *res;
+ if (gethostbyaddr_r(a, l, af, &h,
+ (void *)buf, sizeof buf, &res, &h_errno)) return 0;
+ return &h;
+}