X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fnetworking-posix.c;h=ede69be85f35d83385d2d8acd2e6f5faf3fd44d2;hb=c952badd43d182d58da94c9976ebd8f34e5d805d;hp=58ab1378a90ab147b5794d7e8752e545cbf46053;hpb=564fe71fa8cccb5a6cdbeaf713a2f1eaa7729593;p=mono.git diff --git a/mono/utils/networking-posix.c b/mono/utils/networking-posix.c index 58ab1378a90..ede69be85f3 100644 --- a/mono/utils/networking-posix.c +++ b/mono/utils/networking-posix.c @@ -7,7 +7,7 @@ * (C) 2015 Xamarin */ -#include +#include #include #ifdef HAVE_NETDB_H @@ -26,6 +26,9 @@ #include #endif +#include +#include + static void* get_address_from_sockaddr (struct sockaddr *sa) { @@ -47,6 +50,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 +72,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;