Fix ftell bug after ungetc.
* libc/stdio/ftell.c (_ftell_r): Don't flush ungetc buffer on ftell. * libc/stdio64/ftello64.c (_ftello64_r): Likewise. * libc/stdio/fflush.c (_fflush_r): Clear unget buffer when repositioning underlying fd offset. -------------------------------------------------------------------
This commit is contained in:
parent
be62101c60
commit
9ae00e9e07
|
@ -1,3 +1,12 @@
|
||||||
|
2008-03-03 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
|
Fix ftell bug after ungetc.
|
||||||
|
* libc/stdio/ftell.c (_ftell_r): Don't flush ungetc buffer on
|
||||||
|
ftell.
|
||||||
|
* libc/stdio64/ftello64.c (_ftello64_r): Likewise.
|
||||||
|
* libc/stdio/fflush.c (_fflush_r): Clear unget buffer when
|
||||||
|
repositioning underlying fd offset.
|
||||||
|
|
||||||
2008-03-02 Jeff Johnston <jjohnstn@redhat.com>
|
2008-03-02 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
* libc/include/getopt.h (no_argument): Added for glibc compatibility.
|
* libc/include/getopt.h (no_argument): Added for glibc compatibility.
|
||||||
|
|
|
@ -164,6 +164,8 @@ _DEFUN(_fflush_r, (ptr, fp),
|
||||||
fp->_p = fp->_bf._base;
|
fp->_p = fp->_bf._base;
|
||||||
if (fp->_flags & __SOFF)
|
if (fp->_flags & __SOFF)
|
||||||
fp->_offset = curoff;
|
fp->_offset = curoff;
|
||||||
|
if (HASUB (fp))
|
||||||
|
FREEUB (ptr, fp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,9 +118,12 @@ _DEFUN(_ftell_r, (ptr, fp),
|
||||||
return -1L;
|
return -1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find offset of underlying I/O object, then
|
/* Find offset of underlying I/O object, then adjust for buffered
|
||||||
adjust for buffered bytes. */
|
bytes. Flush a write stream, since the offset may be altered if
|
||||||
_fflush_r (ptr, fp); /* may adjust seek offset on append stream */
|
the stream is appending. Do not flush a read stream, since we
|
||||||
|
must not lose the ungetc buffer. */
|
||||||
|
if (fp->_flags & __SWR)
|
||||||
|
_fflush_r (ptr, fp);
|
||||||
if (fp->_flags & __SOFF)
|
if (fp->_flags & __SOFF)
|
||||||
pos = fp->_offset;
|
pos = fp->_offset;
|
||||||
else
|
else
|
||||||
|
|
|
@ -108,9 +108,12 @@ _DEFUN (_ftello64_r, (ptr, fp),
|
||||||
return -1L;
|
return -1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find offset of underlying I/O object, then
|
/* Find offset of underlying I/O object, then adjust for buffered
|
||||||
adjust for buffered bytes. */
|
bytes. Flush a write stream, since the offset may be altered if
|
||||||
_fflush_r (ptr, fp); /* may adjust seek offset on append stream */
|
the stream is appending. Do not flush a read stream, since we
|
||||||
|
must not lose the ungetc buffer. */
|
||||||
|
if (fp->_flags & __SWR)
|
||||||
|
_fflush_r (ptr, fp);
|
||||||
if (fp->_flags & __SOFF)
|
if (fp->_flags & __SOFF)
|
||||||
pos = fp->_offset;
|
pos = fp->_offset;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue