Author: ngie
Date: Fri Dec  4 09:25:13 2015
New Revision: 291761
URL: https://svnweb.freebsd.org/changeset/base/291761

Log:
  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/10/tools/regression/lib/libc/resolv/resolv.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tools/regression/lib/libc/resolv/resolv.c
==============================================================================
--- stable/10/tools/regression/lib/libc/resolv/resolv.c Fri Dec  4 09:18:59 
2015        (r291760)
+++ stable/10/tools/regression/lib/libc/resolv/resolv.c Fri Dec  4 09:25:13 
2015        (r291761)
@@ -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;
        }
 
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to