summaryrefslogtreecommitdiff
path: root/usr.bin/grep/util.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2012-12-12 11:12:25 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2012-12-12 11:12:25 +0000
commitb50bb182778852d7fd7f10ecd865e3086c655f96 (patch)
tree89e21fd3edf4185137c009c73fc09ef591cd81d3 /usr.bin/grep/util.c
parent283cc40a3ac20f552f19b12bac111cda77c5f366 (diff)
Don't print zero length matches in -o mode. Found by otto@ who
initially proposed a different fix. OK otto@
Diffstat (limited to 'usr.bin/grep/util.c')
-rw-r--r--usr.bin/grep/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index 1fc5ebf44aa..75bbf124c76 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.43 2012/12/11 16:40:01 otto Exp $ */
+/* $OpenBSD: util.c,v 1.44 2012/12/12 11:12:24 millert Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -203,7 +203,7 @@ redo:
}
if (r == 0) {
c = 1;
- if (oflag)
+ if (oflag && pmatch.rm_so != pmatch.rm_eo)
goto print;
break;
}