summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-29 06:17:19 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-29 06:17:19 +0000
commit35a97371b55873aa3ab63f4b80578249723e4147 (patch)
tree0fa226acca58f291807801694e83907d2a7de3c8 /libgfortran
parent76ba288e7307289f8b6eec264346cc762ab042a1 (diff)
downloadgcc-35a97371b55873aa3ab63f4b80578249723e4147.tar.gz
2010-03-29 Tobias Burnus <burnus@net-b.de>
PR fortran/43551 * io/unix.c (buf_write): Set physical_offset after lseek. 2010-03-29 Tobias Burnus <burnus@net-b.de> PR fortran/43551 * gfortran.dg/direct_io_12.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157792 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/io/unix.c18
2 files changed, 16 insertions, 7 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index b13f107f736..4958831010e 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-29 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/43551
+ * io/unix.c (buf_write): Set physical_offset after lseek.
+
2010-03-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/43517
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 4435674b46d..ea3b8bc4b40 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -496,13 +496,17 @@ buf_write (unix_stream * s, const void * buf, ssize_t nbyte)
s->ndirty += nbyte;
}
else
- {
- if (s->file_length != -1 && s->physical_offset != s->logical_offset
- && lseek (s->fd, s->logical_offset, SEEK_SET) < 0)
- return -1;
- nbyte = raw_write (s, buf, nbyte);
- s->physical_offset += nbyte;
- }
+ {
+ if (s->file_length != -1 && s->physical_offset != s->logical_offset)
+ {
+ if (lseek (s->fd, s->logical_offset, SEEK_SET) < 0)
+ return -1;
+ s->physical_offset = s->logical_offset;
+ }
+
+ nbyte = raw_write (s, buf, nbyte);
+ s->physical_offset += nbyte;
+ }
}
s->logical_offset += nbyte;
/* Don't increment file_length if the file is non-seekable. */