diff options
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r-- | libgfortran/io/unix.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 9d2e9d85087..e690aec77a5 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 |