lock.c: Truls Beckens was right #2

also, what the hell?

Fixed the obvious stuff and returned atomicity to the locking - no, access() isn't safe when you want that.