Date: Wed, 16 Aug 2017 00:42:52 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322559 - stable/11/usr.bin/grep Message-ID: <201708160042.v7G0gqZM037745@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Wed Aug 16 00:42:51 2017 New Revision: 322559 URL: https://svnweb.freebsd.org/changeset/base/322559 Log: MFC r316542: bsdgrep: Handle special case of single-byte NUL pattern PR: 202022 Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/grep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 00:40:13 2017 (r322558) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 00:42:51 2017 (r322559) @@ -315,8 +315,12 @@ read_patterns(const char *fn) } len = 0; line = NULL; - while ((rlen = getline(&line, &len, f)) != -1) + while ((rlen = getline(&line, &len, f)) != -1) { + if (line[0] == '\0') + continue; add_pattern(line, line[0] == '\n' ? 0 : (size_t)rlen); + } + free(line); if (ferror(f)) err(2, "%s", fn);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708160042.v7G0gqZM037745>