From: Jeffrey Armstrong Date: Fri, 29 Aug 2014 20:46:15 +0000 (+0000) Subject: PR 62215 Reinstate unlinking old module file before renaming. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70103202db7460b1598f22d09a56ba6db483673e;p=gcc.git PR 62215 Reinstate unlinking old module file before renaming. 2014-08-29 Jeffrey Armstrong PR fortran/62215 * module.c (gfc_dump_module): Unlink old module file before renaming new one. From-SVN: r214742 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a6abbe20038..003e383afad 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2014-08-29 Jeffrey Armstrong + + PR fortran/62215 + * module.c (gfc_dump_module): Unlink old module file before + renaming new one. + 2014-08-26 Thomas Koenig * frontend_passes (expr_array): Replace by vec template. 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));