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

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Aug 22 14:24:51 UTC 2016


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

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

> Moreover, the whole code is broken for empty input,
> it returns NULL instead of pointer to L'\0'

No, the code is correct in *that* respect.

Empty input means we are at EOF right away.  At EOF, the function is documented
to return NULL without setting errno or the stdio error indicator.  Returning
L"" means there is an empty line, and an empty line is not the same as empty
input.

For example:

Empty line:  Reading from the pipe 'printf "\n" |' returns L"" to the first
call of fgetwln(3) and NULL to the second.

Empty input:  Reading from the pipe 'printf "" |' returns NULL to the first
call of fgetwln(3).

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


More information about the freebsd-bugs mailing list