Turn two errors, which are possible to trigger only by bugs,

into assertions.

Discussed with:	mav@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2014-09-05 14:48:06 +00:00
parent 1c64231eac
commit 0488e848d9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271169

View File

@ -1760,9 +1760,7 @@ main_loop(struct conf *conf, bool dont_fork)
client_salen = sizeof(client_sa);
kernel_accept(&connection_id, &portal_id,
(struct sockaddr *)&client_sa, &client_salen);
if (client_salen < client_sa.ss_len)
log_errx(1, "salen %u < %u",
client_salen, client_sa.ss_len);
assert(client_salen >= client_sa.ss_len);
log_debugx("incoming connection, id %d, portal id %d",
connection_id, portal_id);
@ -1806,10 +1804,8 @@ main_loop(struct conf *conf, bool dont_fork)
&client_salen);
if (client_fd < 0)
log_err(1, "accept");
if (client_salen < client_sa.ss_len)
log_errx(1, "salen %u < %u",
client_salen,
client_sa.ss_len);
assert(client_salen >= client_sa.ss_len);
handle_connection(portal, client_fd,
(struct sockaddr *)&client_sa,
dont_fork);