diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-15 18:38:01 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-15 18:38:01 +0000 |
commit | e4b7d3d3e2b13c4bd92f606b1b075b517ea4cecb (patch) | |
tree | 5d55235146e0c9a873af0fc5614927620d955063 | |
parent | 4ef2d2947a66472a3c4487fa9836b410924f4dc0 (diff) | |
download | busybox-w32-e4b7d3d3e2b13c4bd92f606b1b075b517ea4cecb.tar.gz busybox-w32-e4b7d3d3e2b13c4bd92f606b1b075b517ea4cecb.tar.bz2 busybox-w32-e4b7d3d3e2b13c4bd92f606b1b075b517ea4cecb.zip |
grep: -r didn't close files, producing "Too many open files"
git-svn-id: svn://busybox.net/trunk/busybox@16392 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | findutils/grep.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 12cad34aa..04dd2b0e4 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -301,6 +301,7 @@ static int file_action_grep(const char *filename, struct stat *statbuf, void* ma | |||
301 | } | 301 | } |
302 | cur_file = filename; | 302 | cur_file = filename; |
303 | *(int*)matched += grep_file(file); | 303 | *(int*)matched += grep_file(file); |
304 | fclose(file); | ||
304 | return 1; | 305 | return 1; |
305 | } | 306 | } |
306 | 307 | ||
@@ -446,13 +447,13 @@ int grep_main(int argc, char **argv) | |||
446 | } | 447 | } |
447 | } | 448 | } |
448 | matched += grep_file(file); | 449 | matched += grep_file(file); |
450 | bb_fclose_nonstdin(file); | ||
449 | grep_done: | 451 | grep_done: |
450 | if (matched < 0) { | 452 | if (matched < 0) { |
451 | /* we found a match but were told to be quiet, stop here and | 453 | /* we found a match but were told to be quiet, stop here and |
452 | * return success */ | 454 | * return success */ |
453 | break; | 455 | break; |
454 | } | 456 | } |
455 | bb_fclose_nonstdin(file); | ||
456 | } | 457 | } |
457 | 458 | ||
458 | /* destroy all the elments in the pattern list */ | 459 | /* destroy all the elments in the pattern list */ |