From: Jeff King Date: Sun, 11 Jan 2009 11:40:32 GMT Subject: Re: [PATCH 2/4] chain kill signals for cleanup functions Message-ID: <20090111114032.GA30032@coredump.intra.peff.net> In-Reply-To: <20090111113211.GB29791@coredump.intra.peff.net> On Sun, Jan 11, 2009 at 06:32:12AM -0500, Jeff King wrote: > @@ -1968,7 +1969,7 @@ static void run_external_diff(const char *pgm, > atexit_asked = 1; > atexit(remove_tempfile); > } > - signal(SIGINT, remove_tempfile_on_signal); > + sigchain_push(SIGINT, remove_tempfile_on_signal); Hmm. Note that because we are now pushing instead of just replacing the signal handler, it might matter if it gets called multiple times (though I think most of the cleanup functions are relatively harmless if run multiple times). Most of the callsites protect against installing the signal handler twice, but I think this one should probably be moved up inside the atexit_asked condition: if (! atexit_asked && (temp[0].name == temp[0].tmp_path || temp[1].name == temp[1].tmp_path)) { atexit_asked = 1; atexit(remove_tempfile); } sigchain_push_common(remove_tempfile_on_signal); -Peff