ws2_32: Implement SO_GET_MAX_MSG_SIZE for getsockopt.

Dmitry Timoshkov dmitry at codeweavers.com
Tue Nov 28 10:05:54 CST 2006


"Kai Blin" <kai.blin at gmail.com> wrote:

> +static void test_extendedSocketOptions()
> +{
> +    WSADATA wsa;
> +    SOCKET sock;
> +    struct sockaddr_in sa;
> +    int sa_len = sizeof(struct sockaddr_in);
> +    ULONG optval, optlen = sizeof(ULONG);

Why to use ULONG if what you later cast it to is 'int *', and according to
the docs (and your implementation) SO_MAX_MSG_SIZE expects sizeof(int) for
the optval?

...
> +    if(bind(sock, (struct sockaddr *) &sa, (int)sa_len) < 0){

There is not need for a cast, sa_len has the type 'int'.

> +        trace("Failed to bind socket: 0x%08x\n", WSAGetLastError());
> +        closesocket(sock);
> +        WSACleanup();
> +        exit(1);

This kills the whole process instead of terminating gracefully just this
particular test.

> +    }
> +
> +    ret = getsockopt(sock, SOL_SOCKET, SO_MAX_MSG_SIZE, (char *)&optval, (int *)&optlen);

-- 
Dmitry.



More information about the wine-devel mailing list