diff options
author | Jeff King <peff@peff.net> | 2009-01-22 01:03:08 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-21 22:46:53 -0800 |
commit | 57b235a4bc8884a57c6f863605a54b7bfceb0997 (patch) | |
tree | 7128eed3ea8f2352f3b43e810d9edce740f920e8 /sigchain.c | |
parent | 4a16d072723b48699ea162da24eff05eba298834 (diff) | |
download | git-57b235a4bc8884a57c6f863605a54b7bfceb0997.tar.gz |
refactor signal handling for cleanup functions
The current code is very inconsistent about which signals
are caught for doing cleanup of temporary files and lock
files. Some callsites checked only SIGINT, while others
checked a variety of death-dealing signals.
This patch factors out those signals to a single function,
and then calls it everywhere. For some sites, that means
this is a simple clean up. For others, it is an improvement
in that they will now properly clean themselves up after a
larger variety of signals.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sigchain.c')
-rw-r--r-- | sigchain.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sigchain.c b/sigchain.c index a18d505e56..1118b99e57 100644 --- a/sigchain.c +++ b/sigchain.c @@ -41,3 +41,12 @@ int sigchain_pop(int sig) s->n--; return 0; } + +void sigchain_push_common(sigchain_fun f) +{ + sigchain_push(SIGINT, f); + sigchain_push(SIGHUP, f); + sigchain_push(SIGTERM, f); + sigchain_push(SIGQUIT, f); + sigchain_push(SIGPIPE, f); +} |