Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Dec 2015 09:27:56 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r291762 - stable/9/tools/regression/lib/libc/resolv
Message-ID:  <201512040927.tB49RuQL054734@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));



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