Xref: utzoo comp.bugs.sys5:670 comp.unix.wizards:12156 comp.unix.questions:10099 Path: utzoo!attcan!utgpu!utstat!geoff From: geoff@utstat.uucp (Geoff Collyer) Newsgroups: comp.bugs.sys5,comp.unix.wizards,comp.unix.questions Subject: Re: ln(1) and System V Message-ID: <1988Nov6.074740.25667@utstat.uucp> Date: 6 Nov 88 07:47:40 GMT References: <1808@desint.UUCP> Organization: Statistics, U. of Toronto Lines: 14 I see a race in Geoff Kuenning's inventive solution to locking with ln(1) on System V: > trap "" 1 2 15 > touch lock > ln lock lock1 || exit 1 > trap "rm -f lock lock1; exit 1" 1 2 15 If the "rm -f lock lock1" runs in one copy of this script just after the "touch lock" runs in another, then the ln will fail unnecessarily. The race can be fixed by simply not removing "lock", since "lock1" is the real lock. -- Geoff Collyer utzoo!utstat!geoff, geoff@utstat.toronto.edu