aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/fortran/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/fortran/module.c')
-rw-r--r--gcc-4.9/gcc/fortran/module.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc-4.9/gcc/fortran/module.c b/gcc-4.9/gcc/fortran/module.c
index 2bfe17784..f50c5b740 100644
--- a/gcc-4.9/gcc/fortran/module.c
+++ b/gcc-4.9/gcc/fortran/module.c
@@ -6072,7 +6072,10 @@ gfc_dump_module (const char *name, int dump_flag)
|| crc_old != crc)
{
/* Module file have changed, replace the old one. */
- if (rename (filename_tmp, filename))
+ if (unlink (filename) && errno != ENOENT)
+ gfc_fatal_error ("Can't delete module file '%s': %s", filename,
+ xstrerror (errno));
+ if (rename (filename_tmp, filename))
gfc_fatal_error ("Can't rename module file '%s' to '%s': %s",
filename_tmp, filename, xstrerror (errno));
}