ln(1) and System V
Geoff Collyer
geoff at utstat.uucp
Sun Nov 6 17:47:40 AEST 1988
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 at utstat.toronto.edu
More information about the Comp.unix.questions
mailing list