diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-12-21 20:50:48 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-12-21 20:50:48 +0000 |
commit | a0edd35cf6cbcb81d95afcd8f8c9d2ac539d0314 (patch) | |
tree | 93cf317bbe8bfd584d0ba14a16d22921b2c687df /libgfortran | |
parent | 4b71920ab69eb13e47c66228b3dc369cd34b77f1 (diff) | |
download | gcc-a0edd35cf6cbcb81d95afcd8f8c9d2ac539d0314.zip gcc-a0edd35cf6cbcb81d95afcd8f8c9d2ac539d0314.tar.gz gcc-a0edd35cf6cbcb81d95afcd8f8c9d2ac539d0314.tar.bz2 |
re PR libfortran/30162 (Document when sequential I/O with named pipes works)
2012-12-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/30162
* io/unix.c (raw_tell): If the lseek is done on a
non-seekable file, return 0.
From-SVN: r194679
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 32f9bbe..566a24b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2012-12-21 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/30162 + * io/unix.c (raw_tell): If the lseek is done on a + non-seekable file, return 0. + 2012-12-20 Janus Weil <janus@gcc.gnu.org> PR fortran/36044 diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 9d2e9d8..e690aec 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -344,7 +344,15 @@ raw_seek (unix_stream * s, gfc_offset offset, int whence) static gfc_offset raw_tell (unix_stream * s) { - return lseek (s->fd, 0, SEEK_CUR); + gfc_offset x; + x = lseek (s->fd, 0, SEEK_CUR); + + /* Non-seekable files should always be assumed to be at + current position. */ + if (x == -1 && errno == ESPIPE) + x = 0; + + return x; } static gfc_offset |