Le 20/09/2017 à 19:29, Carlo Arenas a écrit : > On Wed, Sep 20, 2017 at 1:39 AM, Laurent Vivier <laur...@vivier.eu > <mailto:laur...@vivier.eu>> wrote: > > Why did you remove "optname = SO_LINGER" and "if (optlen != > sizeof(struct target_linger))"? > > > the optname assignment is not really needed, since it is only used for > the setsockopt call and that call is clearer using SO_LINGER directly, > so to avoid hard to see bugs like : > > http://lists.nongnu.org/archive/html/qemu-devel/2016-01/msg00980.html
Okay > the test for optlen is replaced by passing optlen to the underlying > setsockopt call directly, who would do the test and return the right error. You can't do that, because sizeof(struct linger) may be different from sizeof(struct target_linger). > as an interesting note, I noticed when testing (in ubuntu artful x86_64) > that regardless of how you interpret the documentation, setsockopt won't > fail just because the len is smaller than the size of the struct, and Right, see: http://elixir.free-electrons.com/linux/latest/source/net/core/sock.c#L830 > therefore that code was not equivalent to the setsockopt it was trying > to emulate, and therefore this change doesn't only make the code simpler > but also more correct IMHO Next time add a revision history in your series explaining your changes (and don't reply to the previous patch series for the new series, it's better to start a new email thread). Thanks, Laurent