2009-10-22 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / utils / mono-md5.c
index 28adc408fd8539268402f9a256851486ffcfaba6..09b6291372fa4e6c847a981044dcf077aabb8ef9 100644 (file)
@@ -308,7 +308,7 @@ md5_transform (guint32 buf[4], const guint32 in[16])
  * the 16 bytes buffer @digest .
  **/
 void
-mono_md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16])
+mono_md5_get_digest (const guchar *buffer, gint buffer_size, guchar digest[16])
 {      
        MonoMD5Context ctx;
 
@@ -326,6 +326,8 @@ mono_md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16])
  * 
  * Get the md5 hash of a file. The result is put in 
  * the 16 bytes buffer @digest .
+ * 
+ * If an IO error happens the value in @digest is not updated.
  **/
 void
 mono_md5_get_digest_from_file (const gchar *filename, guchar digest[16])
@@ -347,6 +349,8 @@ mono_md5_get_digest_from_file (const gchar *filename, guchar digest[16])
        if (ferror(fp)) {
                fclose(fp);
                return;
+       } else {
+               fclose(fp);
        }
 
        mono_md5_final (&ctx, digest);