From owner-svn-src-head@freebsd.org Wed Apr 5 20:11:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C26FED2FD44; Wed, 5 Apr 2017 20:11:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92F1DD5E; Wed, 5 Apr 2017 20:11:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v35KB57Q047286; Wed, 5 Apr 2017 20:11:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v35KB55U047285; Wed, 5 Apr 2017 20:11:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201704052011.v35KB55U047285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 5 Apr 2017 20:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316542 - head/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2017 20:11:06 -0000 Author: emaste Date: Wed Apr 5 20:11:05 2017 New Revision: 316542 URL: https://svnweb.freebsd.org/changeset/base/316542 Log: bsdgrep: Handle special case of single-byte NUL pattern PR: 202022 Submitted by: Kyle Evans MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D10102 Modified: head/usr.bin/grep/grep.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Wed Apr 5 19:52:49 2017 (r316541) +++ head/usr.bin/grep/grep.c Wed Apr 5 20:11:05 2017 (r316542) @@ -314,8 +314,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);