This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gprof: Close input files when done with them


Without this, we run out of file descriptors when given lots of
gmon.out files at once.

Okay to apply?


Segher


gprof/ChangeLog:

2010-03-16  Segher Boessenkool  <segher@kernel.crashing.org>

	* gmon_io.c (gmon_out_read): Close file when done.

---
 gprof/gmon_io.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index f48d3bc..1b046d4 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -573,6 +573,9 @@ gmon_out_read (const char *filename)
       done (1);
     }
 
+  if (ifp != stdin)
+    fclose (ifp);
+
   if (output_style & STYLE_GMON_INFO)
     {
       printf (_("File `%s' (version %d) contains:\n"),
-- 
1.6.5.2.154.g549c


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]