diff options
Diffstat (limited to 'lib/libc/stdio/ftell.c')
-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 155248527072..7259e72109ee 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 |