re PR libfortran/30162 (Document when sequential I/O with named pipes works)

2012-12-22  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/30162
	Backport from trunk
	* io/unix.c (raw_tell):  If the lseek is done on a
	non-seekable file, return 0.

From-SVN: r194694
This commit is contained in:
Thomas Koenig 2012-12-22 10:46:37 +00:00
parent 32e1cd769c
commit 338988881a
2 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2012-12-22 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/30162
Backport from trunk
* io/unix.c (raw_tell): If the lseek is done on a
non-seekable file, return 0.
2012-10-12 Thomas König <tkoenig@gcc.gnu.org>
PR libfortran/54736

View File

@ -329,7 +329,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