Strict in the POSIX sence, if file position is unspecified after ungetc() at

0, return that we can't specify it, i.e. error with ESPIPE.
(hint from: "Peter S. Housel" <housel@acm.org>)

Back out sinit() addition, not needed after various code simplifications.
This commit is contained in:
ache 2001-09-01 12:13:33 +00:00
parent 7969ae86e7
commit 95153484d6

View File

@ -78,17 +78,15 @@ ftello(fp)
fpos_t rv;
int ret;
/* make sure stdio is set up */
if (!__sdidinit)
__sinit();
FLOCKFILE(fp);
ret = _ftello(fp, &rv);
FUNLOCKFILE(fp);
if (ret)
return (-1);
if (rv < 0) /* Unspecified value because of ungetc() at 0 */
rv = 0;
if (rv < 0) { /* Unspecified value because of ungetc() at 0 */
errno = ESPIPE;
return (-1);
}
return (rv);
}