Use lockf() instead of flock()

lockf() is generally considered more portable.
The major problem with flock() is that it does not work
on NFS files, making it impossible to create attic repositories
on NFS mounts.