aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/open.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2013-02-21 21:03:10 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2013-02-21 21:03:10 +0200
commit68aab0e225dbafdaa8115092b0ed829ab5c9d161 (patch)
tree26f483a5c4fc248264b7e8d76bab4ca11eb5159a /libgfortran/io/open.c
parenta4a66330d53ed57deec63c7f1018d5e52c92ca4c (diff)
downloadgcc-68aab0e225dbafdaa8115092b0ed829ab5c9d161.zip
gcc-68aab0e225dbafdaa8115092b0ed829ab5c9d161.tar.gz
gcc-68aab0e225dbafdaa8115092b0ed829ab5c9d161.tar.bz2
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 r194679. (raw_size): Return size field only for regular files, otherwise 0. From-SVN: r196210
Diffstat (limited to 'libgfortran/io/open.c')
-rw-r--r--libgfortran/io/open.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 2895767..d9cfde8 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -152,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;
+ }
}