From 17b660861e3bf15f451a8c2bf1a04a878ab11076 Mon Sep 17 00:00:00 2001 From: mvs Date: Tue, 8 Aug 2023 22:07:25 +0000 Subject: [PATCH] Merge SO_BINDANY cases from both switch blocks within sosetopt(). This time SO_LINGER case is separated, so there is no reason for dedicated switch block. ok bluhm --- sys/kern/uipc_socket.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index ea7d0e4aeb1..6c2f93cda67 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.308 2023/08/08 22:06:27 mvs Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.309 2023/08/08 22:07:25 mvs Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -1799,13 +1799,6 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m) } error = ENOPROTOOPT; } else { - switch (optname) { - case SO_BINDANY: - if ((error = suser(curproc)) != 0) /* XXX */ - return (error); - break; - } - switch (optname) { case SO_LINGER: @@ -1824,6 +1817,10 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m) break; case SO_BINDANY: + if ((error = suser(curproc)) != 0) /* XXX */ + return (error); + /* FALLTHROUGH */ + case SO_DEBUG: case SO_KEEPALIVE: case SO_USELOOPBACK: -- 2.20.1