]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/30162 (Document when sequential I/O with named pipes works)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 21 Dec 2012 20:50:48 +0000 (20:50 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 21 Dec 2012 20:50:48 +0000 (20:50 +0000)
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.

From-SVN: r194679

libgfortran/ChangeLog
libgfortran/io/unix.c

index 32f9bbe7fd9632c8e40131420543d2c95f639a1b..566a24bd55bfd56caadd9079aa5412ddcb69d8da 100644 (file)
@@ -1,3 +1,9 @@
+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
index 9d2e9d850879979e73331d60e26f095ffb0bce3f..e690aec77a562f17438624c878e31034f6486724 100644 (file)
@@ -344,7 +344,15 @@ raw_seek (unix_stream * s, gfc_offset offset, int whence)
 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