aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index ba8392d21a1..8b9d7a77342 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -342,15 +342,7 @@ raw_seek (unix_stream * s, gfc_offset offset, int whence)
static gfc_offset
raw_tell (unix_stream * s)
{
- 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;
+ return lseek (s->fd, 0, SEEK_CUR);
}
static gfc_offset
@@ -360,7 +352,10 @@ raw_size (unix_stream * s)
int ret = fstat (s->fd, &statbuf);
if (ret == -1)
return ret;
- return statbuf.st_size;
+ if (S_ISREG (statbuf.st_mode))
+ return statbuf.st_size;
+ else
+ return 0;
}
static int