4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

Cygwin: stdio: don't try again to read after EOF

This reverts commit 1f8f7e2d54, "* libc/stdio/refill.c (__srefill):
Try again after EOF on Cygwin."  If EOF is set on a file, the stdio
input functions will now immediately return EOF rather than trying
again to read.  This aligns Cygwin's behavior to that of Linux.

Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251672.html
This commit is contained in:
Ken Brown 2022-07-04 18:32:10 -04:00
parent 2c2c2b631b
commit 1503d14af1
3 changed files with 8 additions and 8 deletions

View File

@ -47,11 +47,9 @@ __srefill_r (struct _reent * ptr,
fp->_r = 0; /* largely a convenience for callers */
#ifndef __CYGWIN__
/* SysV does not make this test; take it out for compatibility */
if (fp->_flags & __SEOF)
return EOF;
#endif
/* if not already reading, have to be reading and writing */
if ((fp->_flags & __SRD) == 0)
@ -115,13 +113,7 @@ __srefill_r (struct _reent * ptr,
fp->_p = fp->_bf._base;
fp->_r = fp->_read (ptr, fp->_cookie, (char *) fp->_p, fp->_bf._size);
#ifndef __CYGWIN__
if (fp->_r <= 0)
#else
if (fp->_r > 0)
fp->_flags &= ~__SEOF;
else
#endif
{
if (fp->_r == 0)
fp->_flags |= __SEOF;

View File

@ -17,6 +17,10 @@ What changed:
opened in byte mode rather than message mode.
Addresses: https://cygwin.com/pipermail/cygwin/2021-March/247987.html
- The stdio input functions no longer try again to read after EOF.
This aligns Cygwin behavior to that of Linux.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251672.html
Bug Fixes
---------

View File

@ -29,6 +29,10 @@ opened in byte mode rather than message mode.
Handle UDP_SEGMENT and UDP_GRO socket options.
</para></listitem>
<listitem><para>
The stdio input functions no longer try again to read after EOF.
</para></listitem>
</itemizedlist>
</sect2>