--- ./otherlibs/unix/socketaddr.c.orig
+++ ./otherlibs/unix/socketaddr.c
@@ -30,6 +30,18 @@
 #include <io.h>
 #endif

+static size_t
+strnlen(const char *s, size_t maxlen)
+{
+	size_t len;
+
+	for (len = 0; len < maxlen; len++, s++) {
+		if (!*s)
+			break;
+	}
+	return (len);
+}
+
 CAMLexport value caml_unix_alloc_inet_addr(struct in_addr * a)
 {
   value res;
