diff options
author | ache <ache@FreeBSD.org> | 2001-09-01 12:13:33 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-09-01 12:13:33 +0000 |
commit | 87850137765d49a874252b2d1a70bc66c472067f (patch) | |
tree | 1f776d55eb2d0d79694823176aa4ea158a0c4c2b /lib/libc/stdio/ftell.c | |
parent | 625f4c5432005830b7f8ae203a8ed7bdcbf67bb0 (diff) | |
download | FreeBSD-src-87850137765d49a874252b2d1a70bc66c472067f.zip FreeBSD-src-87850137765d49a874252b2d1a70bc66c472067f.tar.gz |
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.
Diffstat (limited to 'lib/libc/stdio/ftell.c')
-rw-r--r-- | lib/libc/stdio/ftell.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index 7784c67..e355a20 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -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); } |