[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state co

From: Peter Bex
Subject: Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption"
Date: Sat, 19 Mar 2016 20:47:04 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Mar 19, 2016 at 01:51:01PM +0100, Kooda wrote:
> I may have found a fix for the reader bug that occured recently.
> It seems to be caused by an implementation-dependent behaviour of the
> exit(3) procedure.

Hi Kooda,

Can you elaborate some more on this?  As I understand it, exit() will
flush standard I/O buffers and call any atexit() handlers, whereas
_exit() will skip all those things.

So if I'm not mistaken, in the absence of any atexit() handlers, your
code should perform exactly the same actions as exit() should.

I thought a better fix would be to call fflush _before_ forking.  That
way, the child will always start with empty buffers and we'll avoid
flushing the same data buffers twice (preventing the bug from being
triggered), and we still allow any atexit() handlers to be invoked,
and we won't override a potentially custom user-supplied exit-handler.

Unfortunately, that fix didn't work, so maybe I'm misunderstanding how
and why the current version is breaking.

In any case, I would be hesitant to just hard override the user's


Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]