diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-15 18:38:01 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-15 18:38:01 +0000 |
commit | bf39216cc4e095a7ce9a4b33b778c903b916e18b (patch) | |
tree | 5d55235146e0c9a873af0fc5614927620d955063 | |
parent | c6ec8c96800cd5ebd884ef1bd4d6564bac747f54 (diff) | |
download | busybox-w32-bf39216cc4e095a7ce9a4b33b778c903b916e18b.tar.gz busybox-w32-bf39216cc4e095a7ce9a4b33b778c903b916e18b.tar.bz2 busybox-w32-bf39216cc4e095a7ce9a4b33b778c903b916e18b.zip |
grep: -r didn't close files, producing "Too many open files"
-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 */ |