fprintf() crashes on wide-oriented stream.

Takashi Yano takashi.yano@nifty.ne.jp
Thu Sep 28 08:42:23 GMT 2023


On Thu, 28 Sep 2023 12:58:27 +0900
Takashi Yano wrote:
> On Tue, 26 Sep 2023 12:41:47 +0900
> Takashi Yano wrote:
> > With this patch, __sfputs_r/__sprint_r is split into two versions, one
> > is for vfprintf which does not handle wide string, and the other (newly
> > introduced __sfputws_r/__swprin_r) is for vfwprintf which handles wide
> > string. Please note that fprintf gets working for wide orient stream
> > just like BSD libc, which behaves differently from GNU libc.
> 
> I confirmed musl libc also behaves as BSD libc.
> 
> In the GNU libc (glibc), fprintf() returns -1 with no errno set if the
> stream is wide-oriented.

I also confirmed that Solaris libc behaves as same as BSD libc.

I wonder what are the advantages of the glibc implementation?
Any historical reason?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Newlib mailing list