From de366fc7f1c10adcae48101097794144a8131c5b Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 18 Oct 2022 14:32:27 -0400 Subject: [PATCH] Fix lockfiles never detecting changes 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 --- pkg/lockfile/lockfile_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/lockfile/lockfile_unix.go b/pkg/lockfile/lockfile_unix.go index deca49f79d..b908ce8227 100644 --- a/pkg/lockfile/lockfile_unix.go +++ b/pkg/lockfile/lockfile_unix.go @@ -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