Patch from vodz to correct 'grep -e pattern1 -e pattern2' logic
authorEric Andersen <andersen@codepoet.org>
Wed, 26 May 2004 09:46:41 +0000 (09:46 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 26 May 2004 09:46:41 +0000 (09:46 -0000)
findutils/grep.c

index 3ba746373dbad40904dec0de9b04685d594f200a..6ece0ab126d053a423f13eb16bb8661a92ddcd8f 100644 (file)
@@ -20,8 +20,8 @@
  *
  */
 /*
- * Jun 2003 by Vladimir Oleynik <dzo@simtreas.ru> -
- * correction "-e pattern1 -e -e pattern2" logic and more optimizations.
+ * Apr 2004 by Vladimir Oleynik <dzo@simtreas.ru> -
+ * correction "-e pattern1 -e pattern2" logic and more optimizations.
 */
 
 #include <stdio.h>
@@ -135,11 +135,9 @@ static int grep_file(FILE *file)
                                 */
                                regex_t regex;
                                xregcomp(&regex, pattern_ptr->data, reflags);
-                               ret = regexec(&regex, line, 0, NULL, 0) == 0;
+                               ret |= regexec(&regex, line, 0, NULL, 0) == 0;
                                regfree(&regex);
                        }
-                       if (!ret)
-                               break;
                        pattern_ptr = pattern_ptr->link;
                } /* while (pattern_ptr) */