Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!linus!philabs!seismo!harpo!floyd!vax135!ariel!houti!hogpc!houxm!hocda!spanky!burl!duke!mcnc!rti!trt
From: trt@rti.UUCP
Newsgroups: net.unix-wizards
Subject: Re: bug in uucp locking mechanism
Message-ID: <1124@rti.UUCP>
Date: Wed, 13-Jul-83 18:04:29 EDT
Article-I.D.: rti.1124
Posted: Wed Jul 13 18:04:29 1983
Date-Received: Tue, 19-Jul-83 10:36:22 EDT
References: sri-arpa.2916
Lines: 15

Laurence Lundblade's correction to ulockf.c removes a possible race,
but leaves another still in.  To fix:
	ret = unlink(file);
	sleep(5);		/* added to prevent a race */
	ret = onelock(pid, tempfile, file);
Without the sleep, the following could happen:
	proc A			proc B
	decide lock is dead	decide lock is dead
	unlink lock
	make lock
				unlink lock
				make lock
	...			...
The '5' in sleep(5) could be made larger to reduce the odds of this happening.
	Tom Truscott