From: Eric Andersen Date: Wed, 26 May 2004 09:46:41 +0000 (-0000) Subject: Patch from vodz to correct 'grep -e pattern1 -e pattern2' logic X-Git-Tag: 1_00_rc1~51 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7f164cd05226615e9518e74eceb0b47c15cbe3e6;p=oweals%2Fbusybox.git Patch from vodz to correct 'grep -e pattern1 -e pattern2' logic --- diff --git a/findutils/grep.c b/findutils/grep.c index 3ba746373..6ece0ab12 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -20,8 +20,8 @@ * */ /* - * Jun 2003 by Vladimir Oleynik - - * correction "-e pattern1 -e -e pattern2" logic and more optimizations. + * Apr 2004 by Vladimir Oleynik - + * correction "-e pattern1 -e pattern2" logic and more optimizations. */ #include @@ -135,11 +135,9 @@ static int grep_file(FILE *file) */ regex_t regex; xregcomp(®ex, pattern_ptr->data, reflags); - ret = regexec(®ex, line, 0, NULL, 0) == 0; + ret |= regexec(®ex, line, 0, NULL, 0) == 0; regfree(®ex); } - if (!ret) - break; pattern_ptr = pattern_ptr->link; } /* while (pattern_ptr) */