bug in uucp locking mechanism

trt at rti.UUCP trt at rti.UUCP
Thu Jul 14 08:04:29 AEST 1983


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



More information about the Comp.unix.wizards mailing list