re PR libfortran/18983 (can't open /dev/null as an output file)

2005-01-15  Bud Davis  <bdavis9659@comcast.net>

        PR fortran/18983
        * io/transfer.c (st_write_done): only truncate when it
        is required.

2005-01-15  Bud Davis  <bdavis9659@comcast.net>

        PR fortran/18983
        * gfortran.dg/write_to_null.f90: New test.

From-SVN: r93689
This commit is contained in:
Bud Davis 2005-01-15 08:10:23 +00:00 committed by Bud Davis
parent 6a29dc8b1b
commit e1c74af03a
4 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2005-01-15 Bud Davis <bdavis9659@comcast.net>
PR fortran/18983
* gfortran.dg/write_to_null.f90: New test.
2005-01-14 Andrew Pinski <pinskia@physics.uc.edu>
John David Anglin <dave.anglin@nrc-cnrc.gc.ca>

View File

@ -0,0 +1,9 @@
! { dg-do run }
! pr18983
! could not write to /dev/null
integer i
open(10,file="/dev/null")
do i = 1,100
write(10,*) "Hello, world"
end do
end

View File

@ -1,3 +1,9 @@
2005-01-15 Bud Davis <bdavis9659@comcast.net>
PR fortran/18983
* io/transfer.c (st_write_done): only truncate when it
is required.
2005-01-12 Toon Moene <toon@moene.indiv.nluug.nl>
PR libfortran/19280

View File

@ -1557,9 +1557,13 @@ st_write_done (void)
current_unit->endfile = AT_ENDFILE; /* Just at it now. */
break;
case NO_ENDFILE: /* Get rid of whatever is after this record. */
if (struncate (current_unit->s) == FAILURE)
generate_error (ERROR_OS, NULL);
case NO_ENDFILE:
if (current_unit->current_record > current_unit->last_record)
{
/* Get rid of whatever is after this record. */
if (struncate (current_unit->s) == FAILURE)
generate_error (ERROR_OS, NULL);
}
current_unit->endfile = AT_ENDFILE;
break;