lock.sh: Truls Beckens was right #1
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.
Merge pull request #1 from mar77i/master

Obvious fixes.