summaryrefslogtreecommitdiffstats
path: root/sys/netkey
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-04-01 15:55:44 +0000
committerrwatson <rwatson@FreeBSD.org>2006-04-01 15:55:44 +0000
commit173781a39a4623af3173bfdc1e69f3a3fe4166f2 (patch)
treeed87bc7b9c54b39e377be1c3f07498feba81e4b0 /sys/netkey
parent5965562ffef852fa5b51c73adfd2fe5b75e16380 (diff)
downloadFreeBSD-src-173781a39a4623af3173bfdc1e69f3a3fe4166f2.zip
FreeBSD-src-173781a39a4623af3173bfdc1e69f3a3fe4166f2.tar.gz
In raw and raw-derived socket types, maintain and enforce invariant that
the so_pcb pointer on the socket is always non-NULL. This eliminates countless unnecessary error checks, replacing them with assertions. MFC after: 3 months
Diffstat (limited to 'sys/netkey')
-rw-r--r--sys/netkey/keysock.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/netkey/keysock.c b/sys/netkey/keysock.c
index 7eb7e0b..6a1cb11 100644
--- a/sys/netkey/keysock.c
+++ b/sys/netkey/keysock.c
@@ -295,8 +295,7 @@ key_attach(struct socket *so, int proto, struct thread *p)
struct keycb *kp;
int s, error;
- if (sotorawcb(so) != 0)
- return EISCONN; /* XXX panic? */
+ KASSERT(sotorawcb(so) == NULL, ("key_attach: so_pcb != NULL"));
kp = (struct keycb *)malloc(sizeof *kp, M_PCB, M_WAITOK); /* XXX */
if (kp == 0)
return ENOBUFS;
OpenPOWER on IntegriCloud