Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Aug 2016 14:24:51 +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-mhh5Yp7zoy@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=212033

--- Comment #4 from Ingo Schwarze <schwarze@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.


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