PATCH: sock-fd-type.diff
Patch against: Wine CVS 2002-04-12
Test status: Compiles (no errors/warnings).
Modified Files: dlls/winsock : socket.c
Log message: Martin Wilck Martin.Wilck@Fujitsu-Siemens.com _get_sock_fd_type : New function, retrieve fd type and flags like FILE_GetUnixHandleType(). WSASendTo() /WSARecvFrom(): Use _get_sock_fd_type().
diff -ruNX ignore TMP/wine/dlls/winsock/socket.c MW/wine/dlls/winsock/socket.c --- TMP/wine/dlls/winsock/socket.c Tue Apr 9 13:27:56 2002 +++ MW/wine/dlls/winsock/socket.c Tue Apr 9 13:28:08 2002 @@ -246,6 +246,13 @@ return fd; }
+inline static int _get_sock_fd_type( SOCKET s, enum fd_type *type, int *flags ) +{ + int fd; + if (set_error( wine_server_handle_to_fd( s, GENERIC_READ, &fd, type, flags ) )) return -1; + return fd; +} + static void _enable_event(SOCKET s, unsigned int event, unsigned int sstate, unsigned int cstate) { @@ -1976,15 +1983,16 @@ LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) { - int i, n, fd, err = WSAENOTSOCK; + int i, n, fd, err = WSAENOTSOCK, flags; struct iovec* iovec; struct msghdr msghdr; - + enum fd_type type; + TRACE ("socket %04x, wsabuf %p, nbufs %ld, flags %ld, to %p, tolen %d, ovl %p, func %p\n", s, lpBuffers, dwBufferCount, dwFlags, to, tolen, lpOverlapped, lpCompletionRoutine);
- fd = _get_sock_fd(s); + fd = _get_sock_fd_type( s, &type, &flags );
if ( fd == -1 ) goto error; @@ -3269,14 +3277,15 @@
struct iovec* iovec; struct msghdr msghdr; - int fd, i, length, err = WSAENOTSOCK; + int fd, i, length, err = WSAENOTSOCK, flags; + enum fd_type type;
TRACE("socket %04x, wsabuf %p, nbufs %ld, flags %ld, from %p, fromlen %ld, ovl %p, func %p\n", s, lpBuffers, dwBufferCount, *lpFlags, lpFrom, (lpFromlen ? *lpFromlen : -1L), lpOverlapped, lpCompletionRoutine);
- fd = _get_sock_fd(s); + fd = _get_sock_fd_type( s, &type, &flags );
if (fd == -1) {