This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] patch for unlink on open files
On Mon, Aug 08, 2005 at 07:47:45PM +0200, FX Coudert wrote:
> >Is there any particular reason you're doing the unpack early?
> >As opposed to one hunk
> >
> >#if !HAVE_UNLINK_OPEN_FILE
> > if (u->flags.status == STATUS_SCRATCH || status == CLOSE_DELETE)
> > {
> > char *path = (char *) alloca (u->file_len + 1);
> > unpack_filename (path, u->file, u->file_len);
> > unlink (path);
> > }
> >#endif
>
> The unlink has to be done after the call to close_unit(u), but the call
> frees the memory allocated to u. So, we need to unpack (that will store
> the filename), close the unit and then unlink.
If that's the case, then the u->flags.status check is wrong.
r~