From: jvdelisle Date: Sat, 26 Jan 2019 20:27:16 +0000 (+0000) Subject: 2019-01-26 Jerry DeLisle X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48d79b6a99c24141b1a949d904da53eb00a0ca97;p=thirdparty%2Fgcc.git 2019-01-26 Jerry DeLisle PR libfortran/88020 * io/close.c (st_close): Generate error if calls to 'remove' return an error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268301 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1cb8961d1ad8..adacd8adcac3 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 cbcbf4e71a13..2b35e49c9ccd 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