in reply to Avoiding a race condition

Thanks, all. The system in question is running Linux, so unlinking before unlocking will solve my problem.