Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jan 2020 04:29:09 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356248 - head/usr.sbin/inetd
Message-ID:  <202001010429.0014T9Qh087620@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Wed Jan  1 04:29:08 2020
New Revision: 356248
URL: https://svnweb.freebsd.org/changeset/base/356248

Log:
  inetd: convert remaining bzero(3) to memset(3), NFC
  
  This change is purely in the name of noise reduction from static analyzers
  that want to complain that bzero(3) is obsolete in favor of memset(3).
  
  With this, clang-analyze at least is now noise free. WARNS= 6 also appears
  to have been OK for some time now, so drop the current setting and opt for
  the default.

Modified:
  head/usr.sbin/inetd/Makefile
  head/usr.sbin/inetd/inetd.c

Modified: head/usr.sbin/inetd/Makefile
==============================================================================
--- head/usr.sbin/inetd/Makefile	Wed Jan  1 04:22:04 2020	(r356247)
+++ head/usr.sbin/inetd/Makefile	Wed Jan  1 04:29:08 2020	(r356248)
@@ -9,7 +9,6 @@ MAN=	inetd.8
 MLINKS=	inetd.8 inetd.conf.5
 SRCS=	inetd.c builtins.c
 
-WARNS?=	3
 CFLAGS+= -DLOGIN_CAP
 #CFLAGS+= -DSANITY_CHECK
 

Modified: head/usr.sbin/inetd/inetd.c
==============================================================================
--- head/usr.sbin/inetd/inetd.c	Wed Jan  1 04:22:04 2020	(r356247)
+++ head/usr.sbin/inetd/inetd.c	Wed Jan  1 04:29:08 2020	(r356248)
@@ -410,7 +410,7 @@ main(int argc, char **argv)
 	 */
 	servname = (hostname == NULL) ? "0" /* dummy */ : NULL;
 
-	bzero(&hints, sizeof(struct addrinfo));
+	memset(&hints, 0, sizeof(struct addrinfo));
 	hints.ai_flags = AI_PASSIVE;
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;	/* dummy */
@@ -2293,7 +2293,7 @@ cpmip(const struct servtab *sep, int ctrl)
 			if (chBest->ch_Service)
 				free(chBest->ch_Service);
 			chBest->ch_Service = strdup(sep->se_service);
-			bzero(chBest->ch_Times, sizeof(chBest->ch_Times));
+			memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times));
 		} 
 #ifdef INET6
 		if ((rss.ss_family == AF_INET6 &&
@@ -2307,7 +2307,7 @@ cpmip(const struct servtab *sep, int ctrl)
 			if (chBest->ch_Service)
 				free(chBest->ch_Service);
 			chBest->ch_Service = strdup(sep->se_service);
-			bzero(chBest->ch_Times, sizeof(chBest->ch_Times));
+			memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times));
 		}
 #endif
 		chBest->ch_LTime = t;



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