From df33bf824c533321c9c601d754931179bc379457 Mon Sep 17 00:00:00 2001 From: gjb Date: Wed, 25 Jun 2014 19:22:40 +0000 Subject: [PATCH] MFS9 r267879: Fix a bug in bsdgrep(1) where patterns are not correctly detected. Certain criteria must be met for this bug to show up: * the -w flag is specified, and * neither -o or --color are specified, and * the pattern is part of another word in the line, and * the other word that contains the pattern occurs first PR: 181973 Approved by: re (marius) Sponsored by: The FreeBSD Foundation git-svn-id: svn://svn.freebsd.org/base/releng/9.3@267881 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.bin/grep/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 0a3706fad..15b2da74e 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -336,7 +336,7 @@ procline(struct str *l, int nottext) } /* One pass if we are not recording matches */ - if ((color == NULL && !oflag) || qflag || lflag) + if (!wflag && ((color == NULL && !oflag) || qflag || lflag)) break; if (st == (size_t)pmatch.rm_so) -- 2.45.0