diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-12-18 17:31:57 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-12-21 01:56:20 -0800 |
commit | 0693f9ddad3d9af3d3424087557bbddce480ce3f (patch) | |
tree | bee18d67e504137396ed341f4c847391b0b298fe /lockfile.c | |
parent | c55fae43c4e10e2779e4fb7d70d6f6e4a7645a63 (diff) | |
download | git-0693f9ddad3d9af3d3424087557bbddce480ce3f.tar.gz |
Make sure lockfiles are unlocked when dying on SIGPIPE
We cleaned up lockfiles upon receiving the usual suspects HUP, TERM, QUIT
but a wicked user could kill us of asphyxiation by piping our output to a
pipe that does not read. Protect ourselves by catching SIGPIPE and clean
up the lockfiles as well in such a case.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'lockfile.c')
-rw-r--r-- | lockfile.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lockfile.c b/lockfile.c index 6d75608693..8589155532 100644 --- a/lockfile.c +++ b/lockfile.c @@ -140,6 +140,7 @@ static int lock_file(struct lock_file *lk, const char *path, int flags) signal(SIGHUP, remove_lock_file_on_signal); signal(SIGTERM, remove_lock_file_on_signal); signal(SIGQUIT, remove_lock_file_on_signal); + signal(SIGPIPE, remove_lock_file_on_signal); atexit(remove_lock_file); } lk->owner = getpid(); |