diff options
author | ngie <ngie@FreeBSD.org> | 2015-12-04 09:25:13 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-12-04 09:25:13 +0000 |
commit | 6091b946282d337c56f654bae482a19997be358a (patch) | |
tree | 41b0ad69500ea8f1ff8e75b568638f244905461c /tools | |
parent | a0e8b14febe2c4c25ad8954464e3b4ea5f0278de (diff) | |
download | FreeBSD-src-6091b946282d337c56f654bae482a19997be358a.zip FreeBSD-src-6091b946282d337c56f654bae482a19997be358a.tar.gz |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/lib/libc/resolv/resolv.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/regression/lib/libc/resolv/resolv.c b/tools/regression/lib/libc/resolv/resolv.c index d481ecf..2ec3eeb 100644 --- a/tools/regression/lib/libc/resolv/resolv.c +++ b/tools/regression/lib/libc/resolv/resolv.c @@ -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; } |