diff options
| author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-11 10:34:05 +0000 |
|---|---|---|
| committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-11 10:34:05 +0000 |
| commit | 72909c79c152e947fbfb01cd2a7a662e1bf04417 (patch) | |
| tree | c0537506d38fd9557cb7187d283e93bf64e8276e | |
| parent | 890ab29ec08094bea53020c24ddd380696773326 (diff) | |
| download | ppe42-gcc-72909c79c152e947fbfb01cd2a7a662e1bf04417.tar.gz ppe42-gcc-72909c79c152e947fbfb01cd2a7a662e1bf04417.zip | |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99570 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/testsuite/gfortran.dg/dev_null.f90 | 11 | ||||
| -rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
| -rw-r--r-- | libgfortran/io/unix.c | 6 |
4 files changed, 25 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d2ee0cadcc9..33a1e02c39b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gfortran.dg/dev_null.f90 b/gcc/testsuite/gfortran.dg/dev_null.f90 new file mode 100644 index 00000000000..edf93dbd1fc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dev_null.f90 @@ -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 diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index fa866a1091f..eded92ede0b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -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 diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 865eb68caf8..92eea53ee5b 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -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; |

