On Fri, Aug 04, 2023 at 12:38:23AM +0300, Vitaliy Makkoveev wrote:
> @@ -1856,6 +1856,9 @@ sosetopt(struct socket *so, int level, i
> case SO_SNDLOWAT:
> case SO_RCVLOWAT:
> {
> + struct sockbuf *sb = (optname == SO_SNDBUF ||
> + optname == SO_SNDLOWAT ?
> + &so->so_snd : &so->so_rcv);
> @@ -1910,6 +1896,8 @@ sosetopt(struct socket *so, int level, i
> case SO_SNDTIMEO:
> case SO_RCVTIMEO:
> {
> + struct sockbuf *sb = (optname == SO_SNDTIMEO ?
> + &so->so_snd : &so->so_rcv);
Would it be nicer to set sb in the switch (optname) at the begining?
struct sockbuf *sb = NULL;
switch (optname) {
case SO_SNDBUF:
case SO_SNDLOWAT:
case SO_SNDTIMEO:
sb = &so->so_snd;
break;
case SO_RCVBUF:
case SO_RCVLOWAT:
case SO_RCVTIMEO:
sb = &so->so_rcv;
break;
case SO_BINDANY:
...
}
Anyway, OK bluhm@