[PATCH] lockfile: reset the correct signal
- From
Clemens Buchacher <drizzd@aon.at>
- Date
- May 26, 2008, 19:35 UTC
- Message-ID
- <20080526193513.GA9978@localhost>
- In-Reply-To
- <alpine.DEB.1.00.0805261031480.30431@racer>
In the function remove_lock_file_on_signal(), the signal handler for SIGINT was reset, ignoring the parameter signo.
This did not pose a problem yet, as remove_lock_file_on_signal() was only registered as a SIGINT handler.
Signed-off-by: Clemens Buchacher <drizzd@aon.at> ---
On Mon, May 26, 2008 at 10:34:11AM +0100, Johannes Schindelin wrote:
> Only from the patch did I understand that you actually meant:
Thank you for fixing that.
I also realized that using signals like that can cause races. Shouldn't we use sigaction() instead of signal()?
Clemens --- lockfile.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lockfile.c b/lockfile.c index 663f18f..b0118d0 100644 --- a/lockfile.c +++ b/lockfile.c @@ -24,7 +24,7 @@ static void remove_lock_file(void) static void remove_lock_file_on_signal(int signo) { remove_lock_file(); - signal(SIGINT, SIG_DFL); + signal(signo, SIG_DFL); raise(signo); }
-- 1.5.5.1