[PATCH] ws2_32: hardcode optlen to 4 for setsockopt in the TCP_NODELAY case

Alex Henrie alexhenrie24 at gmail.com
Mon Nov 29 17:09:21 CST 2021


On Mon, Nov 29, 2021 at 4:03 PM Bastien Orivel <eijebong at bananium.fr> wrote:
>
> > case TCP_NODELAY:
> > {
> >     INT nodelay = optval[1];
> >     return server_setsockopt( s, IOCTL_AFD_WINE_SET_TCP_NODELAY,
> > nodelay, sizeof(nodelay) );
> > }
>
> Shouldn't it be `INT nodelay = *optval;` or `optval[0]` ?

Yes, my neurons got crossed. Thanks for catching that.

> After some testing I'm getting this:
>
>
> optlen = -1, 1, 4, 8, 64, 1337 with optval = 1, -> tcp_nodelay = 1
>
> optlen = 4, optval = 0x100 -> tcp_nodelay = 0
>
> It's only reading the first byte which makes sense.
>
>
> I'll add tests to confirm that. I will also add `getsockopt` calls to
> check that the value changed accordingly.

Great!

-Alex



More information about the wine-devel mailing list