perror() changes the orientation of stderr to byte-oriented mode if stderr is not oriented yet.

Corinna Vinschen vinschen@redhat.com
Mon Jul 2 10:33:00 GMT 2018


On Jun 29 21:34, Takashi Yano wrote:
> I am not in a position to comment whether POSIX is wrong or not, so
> nothing about that.

Well, either we all are in this position or nobody of us ;)

> On Thu, 28 Jun 2018 20:31:57 +0200
> Corinna Vinschen wrote:
> > > I tried this but it failed because __sputc_r() called from _fputs_r also
> > > sets orientation. So I have borrowed the codes from __swbuf_r() in wbuf.c
> > > so that the strings are pushed directly into the buffer.
> > 
> > I did.  Thanks for implementing this, but... uhm... I'm not really
> > thrilled.  So much extra code for such a simple thing as perror...?
> > 
> > On second thought I wonder if we shouldn't just go the FreeBSD route.
> 
> Maybe. But I have another possibility. What about this one?

Not sure if I'm missing something, but doesn't that mean the perror
output won't use text mode even if it's requested?

> By the way, I have noticed that psignal() and psiginfo() also have the
> same problem. psignal() belongs to newlib, so the same strategy can
> be applied. However, what can we do for psiginfo()? Only the FreeBSD
> route may be the answer...

I guess the simplest solution is to use the FreeBSD/OpenBSD method
all the time.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20180702/077d50b5/attachment.sig>


More information about the Newlib mailing list