Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Aug 2016 14:12:27 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 212033] fgetwln(3) fails to report most encoding errors
Message-ID:  <bug-212033-8-zM4vPgS2PC@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-212033-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-212033-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D212033

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

> The check miss one condition:  [...]  wc =3D=3D 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 ma=
nual
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 fr=
om
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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-212033-8-zM4vPgS2PC>