Re: fprintf() crashes on wide-oriented stream.
Jeff Johnston <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAOox84tss6dd+=7YbQB2yAVFybk0O4Z4N8mMhcPzXQMPgkh3yw@mail.gmail.com> |
Hi Takashi, I finally took a look at this. The issue is whether POSIX compliance is desired. Corinna would have strong opinions that it is desired and thus, I think she should have her say when she gets back. I personally believe that newlib should have behaved like glibc. I also think the test snippet is invalid and should have performed an fwide call on stdout to reset the wide-orientation and have the code work properly in all cases. -- Jeff J. On Wed, Sep 27, 2023 at 11:58 PM Takashi Yano <[email protected]> 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. > > -- > Takashi Yano <[email protected]> > >