summaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-29 20:46:15 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-29 20:46:15 +0000
commit6843b812545c8f94708624f6332ea3873cc952fc (patch)
tree27689a8202c47dbe0c36077e2bfb5ed2221f4b74 /gcc/fortran/module.c
parent3e76fcb4ff32c704ae78f76f8c597873f90b3a74 (diff)
downloadgcc-6843b812545c8f94708624f6332ea3873cc952fc.tar.gz
PR 62215 Reinstate unlinking old module file before renaming.
2014-08-29 Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> PR fortran/62215 * module.c (gfc_dump_module): Unlink old module file before renaming new one. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214742 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 3d5e247e196..e8e8c98cb31 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -6040,6 +6040,9 @@ gfc_dump_module (const char *name, int dump_flag)
|| crc_old != crc)
{
/* Module file have changed, replace the old one. */
+ 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));