FreeBSD Bugzilla – Attachment 147970 Details for
Bug 181263
grep(1) crashes at memchr/__sfvwrite when using colors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Proposed patch
patch-bsdgrep.txt (text/plain), 1.10 KB, created by
David CARLIER
on 2014-10-04 14:16:03 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
David CARLIER
Created:
2014-10-04 14:16:03 UTC
Size:
1.10 KB
patch
obsolete
>Index: usr.bin/grep/util.c >=================================================================== >--- usr.bin/grep/util.c (revision 272476) >+++ usr.bin/grep/util.c (working copy) >@@ -324,8 +324,7 @@ > if (m < MAX_LINE_MATCHES) > matches[m++] = pmatch; > /* matches - skip further patterns */ >- if ((color == NULL && !oflag) || >- qflag || lflag) >+ if (!oflag || qflag || lflag) > break; > } > } >@@ -336,7 +335,7 @@ > } > > /* One pass if we are not recording matches */ >- if (!wflag && ((color == NULL && !oflag) || qflag || lflag || Lflag)) >+ if (!wflag && (!oflag || qflag || lflag || Lflag)) > break; > > if (st == (size_t)pmatch.rm_so) >@@ -463,7 +462,7 @@ > if (n) > putchar(sep); > /* --color and -o */ >- if ((oflag || color) && m > 0) { >+ if (m > 0) { > for (i = 0; i < m; i++) { > if (!oflag) > fwrite(line->dat + a, matches[i].rm_so - a, 1, >@@ -486,7 +485,11 @@ > putchar('\n'); > } > } else { >+ if (color) >+ fprintf(stdout, "\33[%sm\33[K", color); > fwrite(line->dat, line->len, 1, stdout); >+ if (color) >+ fprintf(stdout, "\33[m\33[K"); > putchar('\n'); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 181263
: 147970