Fix regression when writing formatted sequential to a pipe.
2013-02-21 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/30162 * io/open.c (test_endfile): Call stell only if size != 0. * io/unix.c (raw_tell): Revert r194694. (raw_size): Return size field only for regular files, otherwise 0. From-SVN: r196212
This commit is contained in:
parent
5ed118309d
commit
1bdd16b65a
|
@ -1,3 +1,10 @@
|
|||
2013-02-21 Janne Blomqvist <jb@gcc.gnu.org>
|
||||
|
||||
PR libfortran/30162
|
||||
* io/open.c (test_endfile): Call stell only if size != 0.
|
||||
* io/unix.c (raw_tell): Revert r194694.
|
||||
(raw_size): Return size field only for regular files, otherwise 0.
|
||||
|
||||
2012-12-22 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR libfortran/30162
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
Contributed by Andy Vaught
|
||||
F2003 I/O support contributed by Jerry DeLisle
|
||||
|
||||
|
@ -153,8 +152,12 @@ static const st_option async_opt[] =
|
|||
static void
|
||||
test_endfile (gfc_unit * u)
|
||||
{
|
||||
if (u->endfile == NO_ENDFILE && ssize (u->s) == stell (u->s))
|
||||
u->endfile = AT_ENDFILE;
|
||||
if (u->endfile == NO_ENDFILE)
|
||||
{
|
||||
gfc_offset sz = ssize (u->s);
|
||||
if (sz == 0 || sz == stell (u->s))
|
||||
u->endfile = AT_ENDFILE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
2011
|
||||
Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
Contributed by Andy Vaught
|
||||
F2003 I/O support contributed by Jerry DeLisle
|
||||
|
||||
|
@ -329,15 +327,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
|
||||
|
@ -347,7 +337,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
|
||||
|
|
Loading…
Reference in New Issue