forked from TrueCloudLab/restic
lock: Don't copy the lock when checking for process existence
The lock test creates a lock and checks that it is not stale. This also tests whether the corresponding process still exists. However, it is possible that the lock is refreshed concurrently, which updates the lock timestamp. Calling `processExists()` with a value receiver, however, creates an unsynchronized copy of this field. Thus call the method using a pointer receiver.
This commit is contained in:
parent
dc060356c2
commit
e1ba7ab684
1 changed files with 1 additions and 1 deletions
|
@ -29,7 +29,7 @@ func uidGidInt(u *user.User) (uid, gid uint32, err error) {
|
|||
// checkProcess will check if the process retaining the lock
|
||||
// exists and responds to SIGHUP signal.
|
||||
// Returns true if the process exists and responds.
|
||||
func (l Lock) processExists() bool {
|
||||
func (l *Lock) processExists() bool {
|
||||
proc, err := os.FindProcess(l.PID)
|
||||
if err != nil {
|
||||
debug.Log("error searching for process %d: %v\n", l.PID, err)
|
||||
|
|
Loading…
Reference in a new issue