Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Sep 2014 14:48:06 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271169 - head/usr.sbin/ctld
Message-ID:  <201409051448.s85Em6Mu051456@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Fri Sep  5 14:48:06 2014
New Revision: 271169
URL: http://svnweb.freebsd.org/changeset/base/271169

Log:
  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

Modified:
  head/usr.sbin/ctld/ctld.c

Modified: head/usr.sbin/ctld/ctld.c
==============================================================================
--- head/usr.sbin/ctld/ctld.c	Fri Sep  5 14:35:34 2014	(r271168)
+++ head/usr.sbin/ctld/ctld.c	Fri Sep  5 14:48:06 2014	(r271169)
@@ -1760,9 +1760,7 @@ main_loop(struct conf *conf, bool dont_f
 			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 @@ found:
 					    &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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409051448.s85Em6Mu051456>