This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH] Thread-safe libgfortran (PRs fortran/14943 and fortran/21647)
On Wed, Nov 23, 2005 at 04:39:50PM +1030, Alan Modra wrote:
> > > are failing with a "File already opened in another unit" error. This
> [snip]
> > > if (u2 != NULL
> > > && (options.stdin_unit < 0 || u->unit_number != options.stdin_unit)
> > > && (options.stdout_unit < 0 || u->unit_number != options.stdout_unit)
> > > && (options.stderr_unit < 0 || u->unit_number != options.stderr_unit))
> >
> > I think that ought to be u2->unit_number rather than u->unit_number.
> > Testing...
>
> Yes, that cured it. OK to apply?
>
> * io/open.c (new_unit): Use the right unit number when checking
> for stdin, stdout, stderr.
Looks good to me, sorry for introducing that. I guess you could install this as
obvious. Thanks for fixing it.
> --- libgfortran/io/open.c (revision 107379)
> +++ libgfortran/io/open.c (working copy)
> @@ -339,9 +339,9 @@ new_unit (st_parameter_open *opp, gfc_un
> if ((opp->common.flags & IOPARM_OPEN_HAS_FILE) != 0)
> u2 = find_file (opp->file, opp->file_len);
> if (u2 != NULL
> - && (options.stdin_unit < 0 || u->unit_number != options.stdin_unit)
> - && (options.stdout_unit < 0 || u->unit_number != options.stdout_unit)
> - && (options.stderr_unit < 0 || u->unit_number != options.stderr_unit))
> + && (options.stdin_unit < 0 || u2->unit_number != options.stdin_unit)
> + && (options.stdout_unit < 0 || u2->unit_number != options.stdout_unit)
> + && (options.stderr_unit < 0 || u2->unit_number != options.stderr_unit))
> {
> unlock_unit (u2);
> generate_error (&opp->common, ERROR_ALREADY_OPEN, NULL);
Jakub