From 8c50625d916841a80c1143900dbbd0cb6c6395bb Mon Sep 17 00:00:00 2001 From: burnus Date: Tue, 25 Nov 2008 12:51:44 +0000 Subject: [PATCH] 2008-11-25 Jan Kratochvil PR fortran/38248 * module.c (gfc_dump_module): Check rename/unlink syscalls errors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142190 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/module.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 22f2817..a75f983 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-11-25 Jan Kratochvil + + PR fortran/38248 + * module.c (gfc_dump_module): Check rename/unlink syscalls errors. + 2008-11-25 Eric Botcazou PR fortran/37319 diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 35f5ce5..a49745a 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4850,11 +4850,19 @@ gfc_dump_module (const char *name, int dump_flag) || memcmp (md5_old, md5_new, sizeof (md5_old)) != 0) { /* Module file have changed, replace the old one. */ - unlink (filename); - rename (filename_tmp, filename); + if (unlink (filename)) + gfc_fatal_error ("Can't delete module file '%s': %s", filename, + strerror (errno)); + if (rename (filename_tmp, filename)) + gfc_fatal_error ("Can't rename module file '%s' to '%s': %s", + filename_tmp, filename, strerror (errno)); } else - unlink (filename_tmp); + { + if (unlink (filename_tmp)) + gfc_fatal_error ("Can't delete temporary module file '%s': %s", + filename_tmp, strerror (errno)); + } } -- 2.7.4