svn commit: trunk/busybox/findutils

vda at busybox.net vda at busybox.net
Sun Oct 15 18:38:01 UTC 2006


Author: vda
Date: 2006-10-15 11:38:01 -0700 (Sun, 15 Oct 2006)
New Revision: 16392

Log:
grep: -r didn't close files, producing "Too many open files"


Modified:
   trunk/busybox/findutils/grep.c


Changeset:
Modified: trunk/busybox/findutils/grep.c
===================================================================
--- trunk/busybox/findutils/grep.c	2006-10-15 18:22:05 UTC (rev 16391)
+++ trunk/busybox/findutils/grep.c	2006-10-15 18:38:01 UTC (rev 16392)
@@ -301,6 +301,7 @@
 	}
 	cur_file = filename;
 	*(int*)matched += grep_file(file);
+	fclose(file);
 	return 1;
 }
 
@@ -446,13 +447,13 @@
 			}
 		}
 		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 */




More information about the busybox-cvs mailing list