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>
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user