summaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 458983c4595..cdac0d7dfdd 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -601,10 +601,14 @@ fd_seek (unix_stream * s, gfc_offset offset)
return SUCCESS;
}
- s->physical_offset = s->logical_offset = offset;
- s->active = 0;
+ if (lseek (s->fd, offset, SEEK_SET) >= 0)
+ {
+ s->physical_offset = s->logical_offset = offset;
+ s->active = 0;
+ return SUCCESS;
+ }
- return (lseek (s->fd, offset, SEEK_SET) < 0) ? FAILURE : SUCCESS;
+ return FAILURE;
}