[patch] Handle blank protocol in getservbyname/port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hamster 2.0.0.0 calls getservbyname to convert "nntp" to 119, but it uses "" 
as the protocol rather than NULL or "tcp".  In Windows, an empty string 
works the same as NULL, but Linux looks for a protocol named "".  This 
patch passes NULL to the OS if called with an empty string.

License: X11, LGPL
Changelog:
  Paul Rupe <prupe@myrealbox.com>
  Treat blank protocol the same as NULL in getservbyname & getservbyport


-- 
Paul Rupe   <prupe@myrealbox.com>                "She smiled, in the end."
Index: dlls/winsock/socket.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/socket.c,v
retrieving revision 1.120
diff -u -r1.120 socket.c
--- dlls/winsock/socket.c	24 Feb 2003 20:48:45 -0000	1.120
+++ dlls/winsock/socket.c	16 Mar 2003 20:00:40 -0000
@@ -3158,7 +3158,7 @@
     if( i ) {
         EnterCriticalSection( &csWSgetXXXbyYYY );
         serv = getservbyname(local_buffer,
-                             proto ? (local_buffer + i) : NULL);
+                             proto && *proto ? (local_buffer + i) : NULL);
         if( serv != NULL )
         {
             if( WS_dup_se(serv, dup_flag) )
@@ -3207,7 +3207,8 @@
     struct servent*     serv;
     if (!proto || wsi_strtolo( proto, NULL )) {
         EnterCriticalSection( &csWSgetXXXbyYYY );
-        if( (serv = getservbyport(port, (proto) ? local_buffer : NULL)) != NULL ) {
+        if( (serv = getservbyport(port, proto && *proto ? local_buffer :
+                                                          NULL)) != NULL ) {
             if( WS_dup_se(serv, dup_flag) )
                 retval = se_buffer;
             else SetLastError(WSAENOBUFS);

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux