gethostbyname patch

Andreas Mohr andi at rhlx01.fht-esslingen.de
Tue May 6 08:49:32 CDT 2003


Hi all,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/gethostbyname_2.asp

says that if name is NULL, it should retrieve information for the
local hostname.


Index: dlls/winsock/socket.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/socket.c,v
retrieving revision 1.125
diff -u -r1.125 socket.c
--- dlls/winsock/socket.c	9 Apr 2003 23:33:35 -0000	1.125
+++ dlls/winsock/socket.c	6 May 2003 13:43:08 -0000
@@ -3038,6 +3038,17 @@
     int ebufsize=1024;
     struct hostent hostentry;
     int locerr = ENOBUFS;
+    char local_name[256];
+
+    /* name == NULL means use the local host name */
+    if (name == NULL)
+    {
+	if (WS_gethostname(local_name, sizeof(local_name)) != 0)
+		FIXME("failed to get local host name, please report!\n");
+		
+	name = local_name;
+    }
+    
     host = NULL;
     extrabuf=HeapAlloc(GetProcessHeap(),0,ebufsize) ;
     while(extrabuf) {

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
Tel. +49 7159 800604                http://mohr.de.tt



More information about the wine-patches mailing list