mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 15:54:56 +00:00
grep: -r didn't close files, producing "Too many open files"
This commit is contained in:
parent
c6ec8c9680
commit
bf39216cc4
@ -301,6 +301,7 @@ static int file_action_grep(const char *filename, struct stat *statbuf, void* ma
|
|||||||
}
|
}
|
||||||
cur_file = filename;
|
cur_file = filename;
|
||||||
*(int*)matched += grep_file(file);
|
*(int*)matched += grep_file(file);
|
||||||
|
fclose(file);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,13 +447,13 @@ int grep_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
matched += grep_file(file);
|
matched += grep_file(file);
|
||||||
|
bb_fclose_nonstdin(file);
|
||||||
grep_done:
|
grep_done:
|
||||||
if (matched < 0) {
|
if (matched < 0) {
|
||||||
/* we found a match but were told to be quiet, stop here and
|
/* we found a match but were told to be quiet, stop here and
|
||||||
* return success */
|
* return success */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bb_fclose_nonstdin(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy all the elments in the pattern list */
|
/* destroy all the elments in the pattern list */
|
||||||
|
Loading…
Reference in New Issue
Block a user