changeset 11292:231e6d1b57d6

oct_md5_file: close file after reading
author John W. Eaton <jwe@octave.org>
date Tue, 23 Nov 2010 02:33:34 -0500
parents 5abe6815aa5e
children 202bd0f1863d
files liboctave/ChangeLog liboctave/oct-md5.cc
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Tue Nov 23 02:18:03 2010 -0500
+++ b/liboctave/ChangeLog	Tue Nov 23 02:33:34 2010 -0500
@@ -1,3 +1,7 @@
+2010-11-23  John W. Eaton  <jwe@octave.org>
+
+	* oct-md5.cc (oct_md5_file): Close file after reading.
+
 2010-11-22  John W. Eaton  <jwe@octave.org>
 
 	* boolSparse.cc (SparseBoolMatrix::sum, SparseBoolMatrix::any):
--- a/liboctave/oct-md5.cc	Tue Nov 23 02:18:03 2010 -0500
+++ b/liboctave/oct-md5.cc	Tue Nov 23 02:33:34 2010 -0500
@@ -65,7 +65,11 @@
     {
       unsigned char buf[16];
 
-      if (! md5_stream (ifile, buf))
+      int errflag = md5_stream (ifile, buf);
+
+      fclose (ifile);
+
+      if (! errflag)
         retval = oct_md5_result_to_str (buf);
       else
         (*current_liboctave_error_handler) ("internal error in md5_stream");