https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212033

--- Comment #3 from Ingo Schwarze <[email protected]> ---
(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.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to