aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2019-01-26 20:27:16 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2019-01-26 20:27:16 +0000
commit0e34715e976246fec1a9a5bf9754881cf5375946 (patch)
treec9c4e42a2f8138d97be043ae0d678d76f98a902d /libgfortran
parentb4f964c8ed3e93188f9bbb1b383f989f290faa16 (diff)
downloadgcc-0e34715e976246fec1a9a5bf9754881cf5375946.zip
gcc-0e34715e976246fec1a9a5bf9754881cf5375946.tar.gz
gcc-0e34715e976246fec1a9a5bf9754881cf5375946.tar.bz2
re PR libfortran/89020 (close(status='DELETE') does not remove file)
2019-01-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/88020 * io/close.c (st_close): Generate error if calls to 'remove' return an error. From-SVN: r268301
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/close.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 1cb8961..adacd8a 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/88020
+ * io/close.c (st_close): Generate error if calls to 'remove' return
+ an error.
+
2019-01-17 Andrew Stubbs <ams@codesourcery.com>
Kwok Cheung Yeung <kcy@codesourcery.com>
Julian Brown <julian@codesourcery.com>
diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c
index cbcbf4e..2b35e49 100644
--- a/libgfortran/io/close.c
+++ b/libgfortran/io/close.c
@@ -99,7 +99,11 @@ st_close (st_parameter_close *clp)
else
{
#if HAVE_UNLINK_OPEN_FILE
- remove (u->filename);
+
+ if (remove (u->filename))
+ generate_error (&clp->common, LIBERROR_OS,
+ "File cannot be deleted, possibly in use by"
+ " another process");
#else
path = strdup (u->filename);
#endif
@@ -112,7 +116,10 @@ st_close (st_parameter_close *clp)
#if !HAVE_UNLINK_OPEN_FILE
if (path != NULL)
{
- remove (path);
+ if (remove (u->filename))
+ generate_error (&clp->common, LIBERROR_OS,
+ "File cannot be deleted, possibly in use by"
+ " another process");
free (path);
}
#endif