Author: pfg
Date: Tue Jul 22 18:37:59 2014
New Revision: 268987
URL: http://svnweb.freebsd.org/changeset/base/268987

Log:
  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

Modified:
  head/lib/libc/stdio/ftell.c

Modified: head/lib/libc/stdio/ftell.c
==============================================================================
--- head/lib/libc/stdio/ftell.c Tue Jul 22 17:30:05 2014        (r268986)
+++ head/lib/libc/stdio/ftell.c Tue Jul 22 18:37:59 2014        (r268987)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to