diff options
author | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2009-05-22 07:04:09 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2009-05-22 07:04:09 +0000 |
commit | eebc710d2e45b220f462f0f439db7336ec6b4b9d (patch) | |
tree | 07c6969e6a73cf6ab6f5d8446c0dce4a68d456ae /gcc/fortran/module.c | |
parent | 134ef63846ab66e47efb86eedae8c506d7baf93e (diff) | |
download | gcc-eebc710d2e45b220f462f0f439db7336ec6b4b9d.zip gcc-eebc710d2e45b220f462f0f439db7336ec6b4b9d.tar.gz gcc-eebc710d2e45b220f462f0f439db7336ec6b4b9d.tar.bz2 |
re PR fortran/40195 (Cannot unlink existing module file)
PR fortran/40195
* module.c (read_md5_from_module_file): Close file before returning.
From-SVN: r147793
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 2a48f88..82a4199 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4759,7 +4759,7 @@ read_md5_from_module_file (const char * filename, unsigned char md5[16]) if ((file = fopen (filename, "r")) == NULL) return -1; - /* Read two lines. */ + /* Read the first line. */ if (fgets (buf, sizeof (buf) - 1, file) == NULL) { fclose (file); @@ -4769,8 +4769,12 @@ read_md5_from_module_file (const char * filename, unsigned char md5[16]) /* The file also needs to be overwritten if the version number changed. */ n = strlen ("GFORTRAN module version '" MOD_VERSION "' created"); if (strncmp (buf, "GFORTRAN module version '" MOD_VERSION "' created", n) != 0) - return -1; + { + fclose (file); + return -1; + } + /* Read a second line. */ if (fgets (buf, sizeof (buf) - 1, file) == NULL) { fclose (file); |