Merge pull request #5298 from Martin2112/lock_by_value

Fix lock pass by value and handle error from Release().
This commit is contained in:
Michael Eischer
2025-03-24 14:42:38 +01:00
committed by GitHub

View File

@@ -14,12 +14,15 @@ func uidGidInt(_ *user.User) (uid, gid uint32, err error) {
// checkProcess will check if the process retaining the lock exists.
// Returns true if the process exists.
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)
return false
}
proc.Release()
err = proc.Release()
if err != nil {
debug.Log("error releasing process %d: %v\n", l.PID, err)
}
return true
}