Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 14 Jun 2012 08:35:15 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: Timing of destructors?

On Thu, Jun 14, 2012 at 02:32:47PM +0200, Szabolcs Nagy wrote:
> * Richard Pennington <rich@...nware.com> [2012-06-14 06:01:45 -0500]:
> > which doesn't print "after". This is because stdio is cleaned up before 
> > destructors are called in exit.c. Using stdio in destructors can be handy for 
> > debugging (if nothing else). Would it be evil to modify exit.c to look like 
> > this?:
> > [...]

Yes.

> so i think the most correct is
> 
> /* Only do atexit if they were actually used */
> __funcs_on_exit();
> /* Destructor s**t is kept separate from atexit to avoid bloat */
> if (libc.fini) libc.fini();
> if (libc.ldso_fini) libc.ldso_fini();
> /* Only do stdio flush if they were actually used */
> __fflush_on_exit();
> _Exit(code);

Making the change. And I'll just remove the comment. It was left
behind from an old version of the code that used function pointers and
if(ptr) to make the call. Since it was switched to use weak symbols,
the motivation for the comment seems to have been lost.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.