Host name is the same when querying localhost
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 7 Mar 2011 23:50:07 +0000 (18:50 -0500)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 7 Mar 2011 23:50:07 +0000 (18:50 -0500)
The host name is set to the queried host name when it is the local
machine name. Fixes bug #676260.

mono/metadata/socket-io.c

index 961fc37272e722a7363a9f7010b7cfaedd49c3fc..989c3d49eebe0c9d3f5203b8c1f326ae4e1aa78f 100644 (file)
@@ -2842,12 +2842,16 @@ MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, Mo
        MONO_ARCH_SAVE_REGS;
        
        hostname=mono_string_to_utf8 (host);
-       if (*hostname == '\0')
+       if (*hostname == '\0') {
                add_local_ips = TRUE;
+               *h_name = host;
+       }
 #ifdef HAVE_SIOCGIFCONF
        if (!add_local_ips && gethostname (this_hostname, sizeof (this_hostname)) != -1) {
-               if (!strcmp (hostname, this_hostname))
+               if (!strcmp (hostname, this_hostname)) {
                        add_local_ips = TRUE;
+                       *h_name = host;
+               }
        }
 #endif