From owner-svn-src-all@freebsd.org Wed Aug 16 00:42:53 2017 Return-Path: Delivered-To: svn-src-all@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 16712DD957C; Wed, 16 Aug 2017 00:42:53 +0000 (UTC) (envelope-from kevans@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 D6A27672BC; Wed, 16 Aug 2017 00:42:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7G0gqf3037746; Wed, 16 Aug 2017 00:42:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0gqZM037745; Wed, 16 Aug 2017 00:42:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160042.v7G0gqZM037745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:42:52 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:42:53 -0000 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);