From: Jerry DeLisle Date: Sat, 26 Jan 2019 20:27:16 +0000 (+0000) Subject: re PR libfortran/89020 (close(status='DELETE') does not remove file) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0e34715e976246fec1a9a5bf9754881cf5375946;p=gcc.git re PR libfortran/89020 (close(status='DELETE') does not remove file) 2019-01-26 Jerry DeLisle PR libfortran/88020 * io/close.c (st_close): Generate error if calls to 'remove' return an error. From-SVN: r268301 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1cb8961d1ad..adacd8adcac 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2019-01-26 Jerry DeLisle + + PR libfortran/88020 + * io/close.c (st_close): Generate error if calls to 'remove' return + an error. + 2019-01-17 Andrew Stubbs Kwok Cheung Yeung Julian Brown diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c index cbcbf4e71a1..2b35e49c9cc 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