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:
Andrey A. Chernov 2001-09-01 12:13:33 +00:00
parent 6946977c36
commit 6ff604a73a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82736

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);
}