From 76e174aab98dfc93d396e134296b1c780ad1673d Mon Sep 17 00:00:00 2001 Message-Id: <76e174aab98dfc93d396e134296b1c780ad1673d.1715712566.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 31 May 2010 18:01:56 +0100 Subject: [PATCH] locking.c: Reset alarm state before invoking the target command. Organization: Straylight/Edgeware From: Mark Wooding There's nothing worse than grabbing a lock, trying to do something, and then being killed by an alarm clock midway through. Well, there are probably are worse things, but this commit message isn't the right place to list them. --- locking.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/locking.c b/locking.c index f486ea4..8931dbd 100644 --- a/locking.c +++ b/locking.c @@ -224,7 +224,9 @@ doneopts: errno = 0; } signal(SIGALRM, oalrm); - if (ot) { + if (!ot) + alarm(0); + else { nt = time(0) - nt; if (nt > ot) raise(SIGALRM); -- [mdw]