Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Apr 2010 04:15:21 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r206785 - in stable/8/usr.sbin: . services_mkdb
Message-ID:  <201004180415.o3I4FLoY067199@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Sun Apr 18 04:15:21 2010
New Revision: 206785
URL: http://svn.freebsd.org/changeset/base/206785

Log:
  MFC r206156, r206159, r206163: services_mkdb; generate db file
  from services(5) to increase speed of getserv*()

Added:
     - copied from r206156, head/usr.sbin/services_mkdb/
Directory Properties:
  stable/8/usr.sbin/services_mkdb/   (props changed)
Modified:
  stable/8/usr.sbin/Makefile   (contents, props changed)
  stable/8/usr.sbin/services_mkdb/services_mkdb.c

Modified: stable/8/usr.sbin/Makefile
==============================================================================
--- stable/8/usr.sbin/Makefile	Sun Apr 18 04:07:32 2010	(r206784)
+++ stable/8/usr.sbin/Makefile	Sun Apr 18 04:15:21 2010	(r206785)
@@ -168,6 +168,7 @@ SUBDIR=	${_ac} \
 	${_sade} \
 	${_sendmail} \
 	service \
+	services_mkdb \
 	setfib \
 	setfmac \
 	setpmac \

Modified: stable/8/usr.sbin/services_mkdb/services_mkdb.c
==============================================================================
--- head/usr.sbin/services_mkdb/services_mkdb.c	Sun Apr  4 08:38:14 2010	(r206156)
+++ stable/8/usr.sbin/services_mkdb/services_mkdb.c	Sun Apr 18 04:15:21 2010	(r206785)
@@ -219,7 +219,7 @@ parseservices(const char *fname, StringL
 
 	line = 0;
 	if ((svc = calloc(PMASK + 1, sizeof(StringList **))) == NULL)
-		err(1, "Cannot allocate %zu bytes", PMASK + 1);
+		err(1, "Cannot allocate %zu bytes", (size_t)(PMASK + 1));
 
 	/* XXX: change NULL to "\0\0#" when fparseln fixed */
 	for (; (p = fparseln(fp, &len, &line, NULL, 0)) != NULL; free(p)) {
@@ -271,7 +271,8 @@ parseservices(const char *fname, StringL
 		if (svc[pnum] == NULL) {
 			svc[pnum] = calloc(PROTOMAX, sizeof(StringList *));
 			if (svc[pnum] == NULL)
-				err(1, "Cannot allocate %zu bytes", PROTOMAX);
+				err(1, "Cannot allocate %zu bytes",
+				    (size_t)PROTOMAX);
 		}
 
 		pindex = getprotoindex(sl, proto);
@@ -282,11 +283,11 @@ parseservices(const char *fname, StringL
 
 		/* build list of aliases */
 		if (sl_find(s, name) == NULL) {
-			char *p;
+			char *p2;
 
-			if ((p = strdup(name)) == NULL)
+			if ((p2 = strdup(name)) == NULL)
 				err(1, "Cannot copy string");
-			(void)sl_add(s, p);
+			(void)sl_add(s, p2);
 		}
 
 		if (aliases) {
@@ -294,11 +295,11 @@ parseservices(const char *fname, StringL
 				if (alias[0] == '\0')
 					continue;
 				if (sl_find(s, alias) == NULL) {
-					char *p;
+					char *p2;
 
-					if ((p = strdup(alias)) == NULL)
+					if ((p2 = strdup(alias)) == NULL)
 						err(1, "Cannot copy string");
-					(void)sl_add(s, p);
+					(void)sl_add(s, p2);
 				}
 			}
 		}



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