ws2_32: Implement SO_GET_MAX_MSG_SIZE for getsockopt.

Kai Blin kai.blin at gmail.com
Tue Nov 28 11:21:31 CST 2006


On Tuesday 28 November 2006 17:05, Dmitry Timoshkov wrote:
> "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?

Because another part of the docs says SO_MAX_MSG_SIZE expects ULONG.

>
> ...
>
> > +    if(bind(sock, (struct sockaddr *) &sa, (int)sa_len) < 0){
>
> There is not need for a cast, sa_len has the type 'int'.

Whoops, copy&paste error from my linux test program, where sa_len was a 
size_t.

> > +        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.

Yeah, forgot to convert that from the standalone test I wrote first.
Reading all the code in socket.c must have turned my brain all mushy.

Thanks for catching those. I'll fix it and resubmit. 
Kai

-- 
Kai Blin, <kai Dot blin At gmail Dot com>
WorldForge developer    http://www.worldforge.org/
Wine developer          http://wiki.winehq.org/KaiBlin/
--
Will code for cotton.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20061128/6afd0b57/attachment.pgp


More information about the wine-devel mailing list