diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2014-07-22 18:37:59 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2014-07-22 18:37:59 +0000 |
commit | a333236e635f35f2ebcd5d1bfc56e38ddaab6470 (patch) | |
tree | 3ad40b6a54ddc3ca2b13c379caca2fc85a0d7a7f /lib/libc | |
parent | 6c25615f39cf05f582357b148d87a71d2ebcb102 (diff) | |
download | src-a333236e635f35f2ebcd5d1bfc56e38ddaab6470.tar.gz src-a333236e635f35f2ebcd5d1bfc56e38ddaab6470.zip |
Notes
Diffstat (limited to 'lib/libc')
-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 |