Date: Fri, 4 Dec 2015 09:25:13 +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-10@freebsd.org Subject: svn commit: r291761 - stable/10/tools/regression/lib/libc/resolv Message-ID: <201512040925.tB49PDLS054554@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512040925.tB49PDLS054554>