aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/close.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/close.c')
-rw-r--r--libgfortran/io/close.c11
1 files changed, 9 insertions, 2 deletions
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