diff options
author | pfg <pfg@FreeBSD.org> | 2014-07-22 18:37:59 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-07-22 18:37:59 +0000 |
commit | d72fc351f3a2e3921448c1b57c24c94f68807585 (patch) | |
tree | 3ad40b6a54ddc3ca2b13c379caca2fc85a0d7a7f /lib | |
parent | d784f2418c22e04fadccc3d5438789412f27d728 (diff) | |
download | FreeBSD-src-d72fc351f3a2e3921448c1b57c24c94f68807585.zip FreeBSD-src-d72fc351f3a2e3921448c1b57c24c94f68807585.tar.gz |
Revert r268984:
Check for __SAPP flag before calling sflush. This avoids
performance degradation compared to the previous approach.
Submitted by: ache
MFC after: 2 weeks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdio/ftell.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index 1552485..7259e72 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -97,8 +97,6 @@ _ftello(FILE *fp, fpos_t *offset) * Find offset of underlying I/O object, then * adjust for buffered bytes. */ - if (__sflush(fp)) /* may adjust seek offset on append stream */ - return (1); if (fp->_flags & __SOFF) pos = fp->_offset; else { @@ -120,6 +118,11 @@ _ftello(FILE *fp, fpos_t *offset) if (HASUB(fp)) pos -= fp->_r; /* Can be negative at this point. */ } else if ((fp->_flags & __SWR) && fp->_p != NULL) { + if (fp->_flags & __SAPP) { + pos = _sseek(fp, (fpos_t)0, SEEK_END); + if (pos == -1) + return (1); + } /* * Writing. Any buffered characters cause the * position to be greater than that in the |