From: Colin Watson Date: Sun, 11 Jul 2004 22:34:59 +0000 (+0000) Subject: bsmtp-pull: Note race condition pointed out by Peter Benie. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?p=bin.git;a=commitdiff_plain;h=a542a487167aada858784adf9f5e1d5884da3d18 bsmtp-pull: Note race condition pointed out by Peter Benie. --- diff --git a/bsmtp-pull b/bsmtp-pull index 5c95f92..600763d 100755 --- a/bsmtp-pull +++ b/bsmtp-pull @@ -19,6 +19,8 @@ HOST="$1" # By default, lockfile-create gives up after three minutes, so don't cron # this any more frequently than that without supplying a --retry argument. lockfile-create "$HOST" +# Race condition pointed out by pjb: this doesn't guarantee that the lock is +# held before the critical section starts. lockfile-touch "$HOST" & TOUCH="$!" trap 'kill "$TOUCH"; lockfile-remove "$HOST"' EXIT ERR HUP INT QUIT TERM