Fix BUG 1237

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

 



Modified files:
	dlls/winsock: 	socket.c
	server:		sock.c

ChangeLog:
	Do not clear FD_WINE_CONNECTED on shutdown().
	FD_WINE_CONNECTED (currently unused) can thus be used
	to determine if a stream socket was ever connected.
	
	This fixes BUG 1237, where an app reads from a never-connected
	socket (http://bugs.winehq.com/show_bug.cgi?id=1237)

Index: dlls/winsock/socket.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/socket.c,v
retrieving revision 1.117
diff -u -r1.117 socket.c
--- dlls/winsock/socket.c	23 Jan 2003 21:20:36 -0000	1.117
+++ dlls/winsock/socket.c	24 Jan 2003 09:59:29 -0000
@@ -2835,7 +2835,7 @@
     case 2: /* drop all */
         clear_flags |= FD_READ|FD_WRITE;
     default:
-        clear_flags |= FD_WINE_CONNECTED|FD_WINE_LISTENING;
+        clear_flags |= FD_WINE_LISTENING;
     }
 
     if ( flags & FD_FLAG_OVERLAPPED ) {
Index: server/sock.c
===================================================================
RCS file: /home/wine/wine/server/sock.c,v
retrieving revision 1.39
diff -u -r1.39 sock.c
--- server/sock.c	19 Oct 2002 01:00:59 -0000	1.39
+++ server/sock.c	24 Jan 2003 09:59:32 -0000
@@ -398,7 +398,7 @@
         {
             sock->errors[FD_CLOSE_BIT] = sock_error( sock->obj.fd );
             if ( (event & POLLERR) || ( sock_shutdown_type == SOCK_SHUTDOWN_EOF && (event & POLLHUP) ))
-                sock->state &= ~(FD_WINE_CONNECTED|FD_WRITE);
+                sock->state &= ~FD_WRITE;
             sock->pmask |= FD_CLOSE;
             sock->hmask |= FD_CLOSE;
             if (debug_level)
@@ -494,8 +494,11 @@
     }
     *flags = 0;
     if (sock->flags & WSA_FLAG_OVERLAPPED) *flags |= FD_FLAG_OVERLAPPED;
-    if ( !(sock->state & FD_READ ) )  *flags |= FD_FLAG_RECV_SHUTDOWN;
-    if ( !(sock->state & FD_WRITE ) ) *flags |= FD_FLAG_SEND_SHUTDOWN;
+    if ( sock->type != SOCK_STREAM || sock->state & FD_WINE_CONNECTED )
+    {
+        if ( !(sock->state & FD_READ  ) ) *flags |= FD_FLAG_RECV_SHUTDOWN;
+        if ( !(sock->state & FD_WRITE ) ) *flags |= FD_FLAG_SEND_SHUTDOWN;
+    }
     return FD_TYPE_SOCKET;
 }
 
-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck@Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy







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

  Powered by Linux