PR libfortran/30162
* io/unix.c (raw_tell): If the lseek is done on a
non-seekable file, return 0.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194679
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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