aboutsummaryrefslogtreecommitdiff
path: root/findutils/grep.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-15 18:38:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-15 18:38:01 +0000
commitbf39216cc4e095a7ce9a4b33b778c903b916e18b (patch)
tree5d55235146e0c9a873af0fc5614927620d955063 /findutils/grep.c
parentc6ec8c96800cd5ebd884ef1bd4d6564bac747f54 (diff)
downloadbusybox-bf39216cc4e095a7ce9a4b33b778c903b916e18b.tar.gz
grep: -r didn't close files, producing "Too many open files"
Diffstat (limited to 'findutils/grep.c')
-rw-r--r--findutils/grep.c3
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
}
cur_file = filename;
*(int*)matched += grep_file(file);
+ fclose(file);
return 1;
}
@@ -446,13 +447,13 @@ int grep_main(int argc, char **argv)
}
}
matched += grep_file(file);
+ bb_fclose_nonstdin(file);
grep_done:
if (matched < 0) {
/* we found a match but were told to be quiet, stop here and
* return success */
break;
}
- bb_fclose_nonstdin(file);
}
/* destroy all the elments in the pattern list */