From a8966aac9eaea59cf8e4df012b9f1a56441f271e Mon Sep 17 00:00:00 2001 From: gjb Date: Wed, 25 Jun 2014 18:59:43 +0000 Subject: MFC r267693: 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 Sponsored by: The FreeBSD Foundation --- usr.bin/grep/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.bin') diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 0a3706f..15b2da7 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) -- cgit v1.1