lockfile.c: make lock_file return a meaningful errno on failurei