[BusyBox] Re: grep -f die
Hiroshi Ito
ito at mlb.co.jp
Tue Oct 5 06:40:59 UTC 2004
Sorry, I forgot to attach a patch.
Here it is.
--------
Hiroshi Ito
Media Lab. Inc.,
URL http://www.mlb.co.jp ( Sorry, Japanese only. )
TEL +81-3-5294-7255 FAX +81-3-5294-7256
> I'm using busy box on mipsel machine.
>
> "grep -f file" will cause segmentation fault.
>
> patch is against current CVS,
> please merge it to CVS.
-------------- next part --------------
Index: findutils/grep.c
===================================================================
RCS file: /var/cvs/busybox/findutils/grep.c,v
retrieving revision 1.85
diff -u -r1.85 grep.c
--- findutils/grep.c 26 May 2004 11:48:29 -0000 1.85
+++ findutils/grep.c 5 Oct 2004 06:32:59 -0000
@@ -237,21 +237,16 @@
return nmatches;
}
-static void load_regexes_from_file(llist_t *fopt)
+static void load_regexes_from_file(char *ffile)
{
char *line;
FILE *f;
- while(fopt) {
- llist_t *cur = fopt;
- char *ffile = cur->data;
-
- fopt = cur->link;
- free(cur);
+ if(ffile) {
f = bb_xfopen(ffile, "r");
- while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
- pattern_head = llist_add_to(pattern_head, line);
- }
+ while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
+ pattern_head = llist_add_to(pattern_head, line);
+ }
}
}
@@ -261,7 +256,7 @@
FILE *file;
int matched;
unsigned long opt;
- llist_t *fopt;
+ char *fopt;
/* do normal option parsing */
#ifdef CONFIG_FEATURE_GREP_CONTEXT
More information about the busybox
mailing list