[PATCH] Fix potential reent issue

Freddie Chopin freddie_chopin@op.pl
Sun Jun 23 20:13:00 GMT 2013

W dniu 2013-06-23 21:40, Federico Terraneo pisze:
> On 06/23/2013 07:53 PM, Freddie Chopin wrote:
>> Hi!
>> Wouldn't it be cleaner/simpler to use "_REENT" symbol (which is
>> either "_impure_ptr" or "__getreent()") in place of faulty uses of
>> _impure_ptr?
> The problem is that when _REENT_ONLY is defined, _REENT does not get
> defined (look at sys/reent.h). I think it's this fact that caused the
> faulty use of _impure_ptr, but if the definition of _REENT is enclosed
> in an #ifndef _REENT_ONLY, there's probably a reason.

Yes, you're right...

Looking at repo history it seems that the _impure_ptr solution was 
older, then - 11 years ago - the one using _REENT was added, but the old 
variant remained unchanged for years.

It seems to me that the "right" solution for _REENT_ONLY build would be 
to undefine stdin/stdout/stderr - delete the offending lines using 

If that solution is not feasible then your approach is probably the best 

BTW - I've CCed the list, you probably forgot about that.


More information about the Newlib mailing list