Damjan Jovanovic : ws2_32: gethostbyname("") should work.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 1 06:44:33 CDT 2007


Module: wine
Branch: master
Commit: b23d90a5432750b1a0ce92837624a08791bcb372
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b23d90a5432750b1a0ce92837624a08791bcb372

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Fri Jun  1 09:13:19 2007 +0200

ws2_32: gethostbyname("") should work.

---

 dlls/ws2_32/socket.c     |    2 +-
 dlls/ws2_32/tests/sock.c |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index a39da4a..2bd4c14 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3222,7 +3222,7 @@ struct WS_hostent* WINAPI WS_gethostbyname(const char* name)
     int locerr = ENOBUFS;
 #endif
     char buf[100];
-    if( !name) {
+    if( !name || !name[0]) {
         name = buf;
         if( gethostname( buf, 100) == -1) {
             SetLastError( WSAENOBUFS); /* appropriate ? */
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index d0b9750..3403715 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1665,6 +1665,14 @@ static void test_getsockname(void)
     WSACleanup();
 }
 
+static void test_dns(void)
+{
+    struct hostent *h;
+
+    h = gethostbyname("");
+    ok(h != NULL, "gethostbyname(\"\") failed with %d\n", h_errno);
+}
+
 static void test_inet_addr(void)
 {
     u_long addr;
@@ -1850,6 +1858,7 @@ START_TEST( sock )
     test_accept();
     test_getsockname();
     test_inet_addr();
+    test_dns();
 
     test_send();
     test_write_events();




More information about the wine-cvs mailing list