aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorBud Davis <bdavis@gfortran.org>2005-05-11 10:34:05 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-05-11 10:34:05 +0000
commit802fc8260d06c25a9f6df650a2b6d4f6a7a2ddb7 (patch)
treec0537506d38fd9557cb7187d283e93bf64e8276e /libgfortran
parent5a942c07c2080d0b155717dfeb1683078c493a21 (diff)
downloadgcc-802fc8260d06c25a9f6df650a2b6d4f6a7a2ddb7.zip
gcc-802fc8260d06c25a9f6df650a2b6d4f6a7a2ddb7.tar.gz
gcc-802fc8260d06c25a9f6df650a2b6d4f6a7a2ddb7.tar.bz2
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
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/unix.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index fa866a1..eded92ed 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 865eb68..92eea53 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;