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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 5dc31a5..78ed0f7 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -513,8 +513,15 @@ fd_truncate (unix_stream * s)
/* non-seekable files, like terminals and fifo's fail the lseek.
the fd is a regular file at this point */
+#ifdef HAVE_FTRUNCATE
if (ftruncate (s->fd, s->logical_offset))
return FAILURE;
+#else
+#ifdef HAVE_CHSIZE
+ if (chsize (s->fd, s->logical_offset))
+ return FAILURE;
+#endif
+#endif
s->physical_offset = s->file_length = s->logical_offset;