[Bug 212033] fgetwln(3) fails to report most encoding errors

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Aug 22 14:12:27 UTC 2016


--- Comment #3 from Ingo Schwarze <schwarze at usta.de> ---
(In reply to Andrey Chernov from comment #1)

> The check miss one condition:  [...]  wc == WEOF

Checking wc is needless; it's even safer to *not* check it.
When the error indicator is set, fgetwln(3) should better fail.

Regarding fgetwc(3), POSIX says: "If an error occurs, the resulting value of
the file position indicator for the stream is unspecified."  The OpenBSD manual
says: "The end-of-file condition is remembered, even on a terminal, and all
subsequent attempts to read will return WEOF until the condition is cleared
with clearerr(3)."

So, as soon as the error indicator goes up, all bets are off for reading from
the stream.  In that case, fgetwc(3) is expected to always fail.  And even if
it happened not too, that would just be weird, and fgetwln(3) should better
fail anyway.

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list