[msbuild] bump to help debug wrench build failure
[mono.git] / mono / utils / networking-posix.c
index 58ab1378a90ab147b5794d7e8752e545cbf46053..caa2073a539e10e996ed1273a806ca92f4d3dee3 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * networking-posix.c: Modern posix networking code
+/**
+ * \file
+ * Modern posix networking code
  *
  * Author:
  *     Rodrigo Kumpera (kumpera@gmail.com)
@@ -7,7 +8,7 @@
  * (C) 2015 Xamarin
  */
 
-#include <mono/utils/networking.h>
+#include <config.h>
 #include <glib.h>
 
 #ifdef HAVE_NETDB_H
@@ -26,6 +27,9 @@
 #include <ifaddrs.h>
 #endif
 
+#include <mono/utils/networking.h>
+#include <mono/utils/mono-threads-coop.h>
+
 static void*
 get_address_from_sockaddr (struct sockaddr *sa)
 {
@@ -47,6 +51,7 @@ mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInf
        struct addrinfo hints, *res = NULL, *info;
        MonoAddressEntry *cur = NULL, *prev = NULL;
        MonoAddressInfo *addr_info;
+       int ret;
 
        memset (&hints, 0, sizeof (struct addrinfo));
        *result = NULL;
@@ -68,7 +73,12 @@ mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInf
                hints.ai_flags = AI_ADDRCONFIG;
 #endif
        sprintf (service_name, "%d", port);
-    if (getaddrinfo (hostname, service_name, &hints, &info))
+
+       MONO_ENTER_GC_SAFE;
+       ret = getaddrinfo (hostname, service_name, &hints, &info);
+       MONO_EXIT_GC_SAFE;
+
+       if (ret)
                return 1; /* FIXME propagate the error */
 
        res = info;