+2011-06-11 Janne Blomqvist <jb@gcc.gnu.org>
+
+ * io/unix.c (buf_seek): Return error if file is not seekable.
+ (buf_tell): Call buf_seek.
+
2011-06-11 Janne Blomqvist <jb@gcc.gnu.org>
* io/unix.c (fd_to_stream): Figure out if a fd is seekable by
static gfc_offset
buf_seek (unix_stream * s, gfc_offset offset, int whence)
{
+ if (s->file_length == -1)
+ {
+ errno = ESPIPE;
+ return -1;
+ }
switch (whence)
{
case SEEK_SET:
static gfc_offset
buf_tell (unix_stream * s)
{
- return s->logical_offset;
+ return buf_seek (s, 0, SEEK_CUR);
}
static int