diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-12-04 08:13:28 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-12-04 08:13:28 +0530 |
commit | fe8b4d98e9ac371238388469cb74011cb2120343 (patch) | |
tree | bd78796417f00a31e2112af9fa724b0b732731b0 /libio/wfileops.c | |
parent | 61b4f792e03facb456036b3f631d58d4f53b8075 (diff) | |
download | glibc-fe8b4d98e9ac371238388469cb74011cb2120343.zip glibc-fe8b4d98e9ac371238388469cb74011cb2120343.tar.gz glibc-fe8b4d98e9ac371238388469cb74011cb2120343.tar.bz2 |
Reset cached offset when reading to end of stream (BZ #17653)
POSIX allows applications to switch file handles when a read results
in an end of file. Unset the cached offset at this point so that it
is queried again.
Diffstat (limited to 'libio/wfileops.c')
-rw-r--r-- | libio/wfileops.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libio/wfileops.c b/libio/wfileops.c index 71281c1..2a003b3 100644 --- a/libio/wfileops.c +++ b/libio/wfileops.c @@ -257,7 +257,10 @@ _IO_wfile_underflow (fp) if (count <= 0) { if (count == 0 && naccbuf == 0) - fp->_flags |= _IO_EOF_SEEN; + { + fp->_flags |= _IO_EOF_SEEN; + fp->_offset = _IO_pos_BAD; + } else fp->_flags |= _IO_ERR_SEEN, count = 0; } |