svn commit: r291762 - stable/9/tools/regression/lib/libc/resolv

Garrett Cooper ngie at FreeBSD.org
Fri Dec 4 09:27:57 UTC 2015


Author: ngie
Date: Fri Dec  4 09:27:56 2015
New Revision: 291762
URL: https://svnweb.freebsd.org/changeset/base/291762

Log:
  MFstable/10 r243346,r291761:
  
  r243346 (by emaste):
  
  Non-void function should return a value.
  
  Found by: clang
  
  r291761:
  
  MFC r291359,r291362:
  
  r291359:
  
  Skip over lines that start with # (comments)
  
  r291362:
  
  r291359 was incorrect. Skip over tokens that start with `#' as fgetln can
  return more than one '\n' delimited line in a buffer
  
  Handle empty lines too, just in case

Modified:
  stable/9/tools/regression/lib/libc/resolv/resolv.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/tools/   (props changed)
  stable/9/tools/regression/   (props changed)
  stable/9/tools/regression/lib/libc/   (props changed)

Modified: stable/9/tools/regression/lib/libc/resolv/resolv.c
==============================================================================
--- stable/9/tools/regression/lib/libc/resolv/resolv.c	Fri Dec  4 09:25:13 2015	(r291761)
+++ stable/9/tools/regression/lib/libc/resolv/resolv.c	Fri Dec  4 09:27:56 2015	(r291762)
@@ -90,8 +90,11 @@ load(const char *fname)
 		char c = line[len];
 		char *ptr;
 		line[len] = '\0';
-		for (ptr = strtok(line, WS); ptr; ptr = strtok(NULL, WS))
+		for (ptr = strtok(line, WS); ptr; ptr = strtok(NULL, WS)) {
+			if (ptr == '\0' || ptr[0] == '#')
+				continue;
 			sl_add(hosts, strdup(ptr));
+		}
 		line[len] = c;
 	}
 
@@ -226,7 +229,7 @@ resolvloop(void *p)
 {
 	int *nhosts = (int *)p;
 	if (*nhosts == 0)
-		return;
+		return NULL;
 	do
 		resolvone(*nhosts);
 	while (--(*nhosts));


More information about the svn-src-stable-9 mailing list