summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-03-31 03:48:35 +0000
committerrwatson <rwatson@FreeBSD.org>2004-03-31 03:48:35 +0000
commit6f9005a98d7b1bcf272a920c39213c69156aadb0 (patch)
tree495beb08c1631de96f917132ecac4c35f35692d0
parentab918a532fd463848e1ca42c309930d5c489d7f5 (diff)
downloadFreeBSD-src-6f9005a98d7b1bcf272a920c39213c69156aadb0.zip
FreeBSD-src-6f9005a98d7b1bcf272a920c39213c69156aadb0.tar.gz
In sofree(), avoid nested declaration and initialization in
declaration. Observe that initialization in declaration is frequently incompatible with locking, not just a bad idea due to style(9). Submitted by: bde
-rw-r--r--sys/kern/uipc_socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 83d5e43..df9122c 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -283,6 +283,7 @@ void
sofree(so)
struct socket *so;
{
+ struct socket *head;
int s;
KASSERT(so->so_count == 0, ("socket %p so_count not 0", so));
@@ -290,7 +291,7 @@ sofree(so)
if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0)
return;
if (so->so_head != NULL) {
- struct socket *head = so->so_head;
+ head = so->so_head;
if (so->so_state & SS_INCOMP) {
TAILQ_REMOVE(&head->so_incomp, so, so_list);
head->so_incqlen--;
OpenPOWER on IntegriCloud