Patch: sock-shutdown-file.diff
Enables error handling if ReadFile() WriteFile() are called on a socket after the respective channel of the socket was shut down.
Patch against: CVS 2002-04-12, with my previously submitted patches applied.
Modified files: files: file.c
--- TMP/wine/files/file.c Fri Apr 12 11:54:50 2002 +++ MW/wine/files/file.c Fri Apr 12 11:54:28 2002 @@ -1514,6 +1514,16 @@ SetLastError ( ERROR_INVALID_PARAMETER ); return FALSE; } + if ( ! (flags & FD_FLAG_OVERLAPPED) ) { + WARN ( "fd is not overlapped\n" ); + SetLastError ( ERROR_INVALID_PARAMETER ); + goto error; + } + if ( flags & FD_FLAG_RECV_SHUTDOWN ) { + /* Fixme: WSAESHUTDOWN is unavailable */ + SetLastError ( ERROR_BROKEN_PIPE ); + goto error; + }
ovp = (async_fileio*) HeapAlloc(GetProcessHeap(), 0, sizeof (async_fileio)); if(!ovp) @@ -1730,6 +1740,16 @@ { TRACE( "Couldn't get FD\n" ); return FALSE; + } + if ( ! (flags & FD_FLAG_OVERLAPPED) ) { + WARN ( "fd is not overlapped\n" ); + SetLastError ( ERROR_INVALID_PARAMETER ); + goto error; + } + if ( flags & FD_FLAG_SEND_SHUTDOWN ) { + /* Fixme: WSAESHUTDOWN is unavailable */ + SetLastError ( ERROR_BROKEN_PIPE ); + goto error; }
ovp = (async_fileio*) HeapAlloc(GetProcessHeap(), 0, sizeof (async_fileio));
On April 12, 2002 11:25 am, Martin Wilck wrote:
- if ( flags & FD_FLAG_RECV_SHUTDOWN ) {
/* Fixme: WSAESHUTDOWN is unavailable */
^^^^^^ Don't we want these things as FIXME("WSAESHUTDOWN is unavailable") so we see when we need to fix things?
On Fri, 12 Apr 2002, Dimitrie O. Paun wrote:
On April 12, 2002 11:25 am, Martin Wilck wrote:
- if ( flags & FD_FLAG_RECV_SHUTDOWN ) {
/* Fixme: WSAESHUTDOWN is unavailable */
^^^^^^
Don't we want these things as FIXME("WSAESHUTDOWN is unavailable") so we see when we need to fix things?
I need to figure out what Windows returns here. I think WSAESHUTDOWN cannot be returned because it is a socket error unknown to the ReadFile() function.
We might be able to fix this by handling the error in the server. Anyway, thanks for looking at my code so thoroughly!
Martin