Index | Thread | Search

From:
enh <enh@google.com>
Subject:
ftell
To:
OpenBSD Tech <tech@openbsd.org>
Date:
Thu, 9 Apr 2026 10:37:07 -0400

Download raw body.

Thread
  • enh:

    ftell

    • Todd C. Miller:

      ftell

in ftell(), given:

if (fp->_flags & __SWR)
    __sflush(fp); /* may adjust seek offset on append stream */

it seems like this is dead code because _p should always end up equal
to _bf._base because we just flushed:

} else if (fp->_flags & __SWR && fp->_p != NULL) {
    /*
     * Writing.  Any buffered characters cause the
     * position to be greater than that in the
     * underlying object.
     */
    pos += fp->_p - fp->_bf._base;
}

or am i missing something?