re PR libfortran/19478 (reading back from /dev/null)
PR fortran/19478 * io/unix.c (fd_truncate): update positions when ftruncate fails (like writing to /dev/null). * gfortran.dg/dev_null.f90: New test. From-SVN: r99570
This commit is contained in:
parent
5a942c07c2
commit
802fc8260d
4 changed files with 25 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
2005-05-11 Bud Davis <bdavis@gfortran.org>
|
||||
|
||||
* gfortran.dg/dev_null.f90: New test.
|
||||
|
||||
2005-05-11 Richard Earnshaw <richard.earnshaw@arm.com>
|
||||
|
||||
* gcc.dg/arm-vfp1.c: Revert last change.
|
||||
|
|
11
gcc/testsuite/gfortran.dg/dev_null.f90
Normal file
11
gcc/testsuite/gfortran.dg/dev_null.f90
Normal file
|
@ -0,0 +1,11 @@
|
|||
! { dg-do run }
|
||||
! pr19478 read from /dev/null
|
||||
! Thomas.Koenig@online.de
|
||||
character*20 foo
|
||||
open(10,file="/dev/null")
|
||||
write(10,'(A)') "Hello"
|
||||
rewind(10)
|
||||
read(10,'(A)',end=100) foo
|
||||
call abort
|
||||
100 continue
|
||||
end
|
|
@ -1,3 +1,9 @@
|
|||
2005-05-11 Bud Davis <bdavis@gfortran.org>
|
||||
|
||||
PR fortran/19478
|
||||
* io/unix.c (fd_truncate): update positions when ftruncate
|
||||
fails (like writing to /dev/null).
|
||||
|
||||
2005-05-10 Francois-Xavier Coudert <coudert@clipper.ens.fr>
|
||||
|
||||
PR libfortran/21471
|
||||
|
|
|
@ -515,13 +515,15 @@ fd_truncate (unix_stream * s)
|
|||
|
||||
#ifdef HAVE_FTRUNCATE
|
||||
if (ftruncate (s->fd, s->logical_offset))
|
||||
return FAILURE;
|
||||
#else
|
||||
#ifdef HAVE_CHSIZE
|
||||
if (chsize (s->fd, s->logical_offset))
|
||||
return FAILURE;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
s->physical_offset = s->file_length = 0;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
s->physical_offset = s->file_length = s->logical_offset;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue