Re: [PATCH 3/6] ws2_32: Fix parameters checking in WSADuplicateSocket
Bruno Jesus <00cpxxx(a)gmail.com> writes:
+ fd = get_sock_fd( s, FILE_READ_DATA, NULL ); + if (fd == -1) + { + SetLastError(WSAENOTSOCK); + return SOCKET_ERROR; + } + release_sock_fd( s, fd );
You should avoid retrieving the fd if you are not using it. The handle should be checked at the point where you are doing something with it. -- Alexandre Julliard julliard(a)winehq.org
On Mon, Sep 9, 2013 at 6:39 AM, Alexandre Julliard <julliard(a)winehq.org> wrote:
Bruno Jesus <00cpxxx(a)gmail.com> writes:
+ fd = get_sock_fd( s, FILE_READ_DATA, NULL ); + if (fd == -1) + { + SetLastError(WSAENOTSOCK); + return SOCKET_ERROR; + } + release_sock_fd( s, fd );
You should avoid retrieving the fd if you are not using it. The handle should be checked at the point where you are doing something with it.
I don't need the the handle, I just need to be sure that is a valid socket. The first parameters checked is the socket. I need to find a way to do that and keep the tests working. What if I use a getsockopt(SO_TYPE) ?
-- Alexandre Julliard julliard(a)winehq.org
Regards, Bruno
Bruno Jesus <00cpxxx(a)gmail.com> writes:
On Mon, Sep 9, 2013 at 6:39 AM, Alexandre Julliard <julliard(a)winehq.org> wrote:
Bruno Jesus <00cpxxx(a)gmail.com> writes:
+ fd = get_sock_fd( s, FILE_READ_DATA, NULL ); + if (fd == -1) + { + SetLastError(WSAENOTSOCK); + return SOCKET_ERROR; + } + release_sock_fd( s, fd );
You should avoid retrieving the fd if you are not using it. The handle should be checked at the point where you are doing something with it.
I don't need the the handle, I just need to be sure that is a valid socket. The first parameters checked is the socket. I need to find a way to do that and keep the tests working. What if I use a getsockopt(SO_TYPE) ?
You'll have to do something with the socket (get the protocol), so the check should happen at that point. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Bruno Jesus