Skip to content

Commit

Permalink
Fix lockfiles never detecting changes
Browse files Browse the repository at this point in the history
If we ever check the last-writer of a lock file and get back a zero
value, don't only check if subsequent last-writer values match its first
zero bytes, which is always true, as a test to see if the last-writer
value has remained unchanged.

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Oct 18, 2022
1 parent bd3bbad commit de366fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/lockfile/lockfile_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (l *lockfile) Modified() (bool, error) {
panic("attempted to check last-writer in lockfile without locking it first")
}
defer l.stateMutex.Unlock()
currentLW := make([]byte, len(l.lw))
currentLW := make([]byte, lastWriterIDSize)
n, err := unix.Pread(int(l.fd), currentLW, 0)
if err != nil {
return true, err
Expand Down

0 comments on commit de366fc

Please sign in to comment.