chiark / gitweb /
locking.c, locking.1: Make the protocol safe if the lockfile is (re)moved.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 Apr 2016 22:30:30 +0000 (23:30 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 29 Apr 2016 00:21:44 +0000 (01:21 +0100)
commited1b4ef8dff60ba943f553d5faeb049df9b621b7
tree81cf816365f3be76c75ca89935c83b7dad0714d5
parentb7ec4e9118fa390ec20408390a06f3c51a035155
locking.c, locking.1: Make the protocol safe if the lockfile is (re)moved.

Get the device/inode pair from the lockfile descriptor after we've
opened it (so this is the file we're actually going to lock).  Once
we've acquired the lock, check that the file /name/ still has the same
device/inode pair.  If nobody is allowed to move or unlink the lockfile
while we've got the lock, then we know (assuming this check passes) that
we've actually locked the right file and not some deleted thing.
locking.1
locking.c