Fix lock pass by value and handle error from Release().

This commit is contained in:
Martin Smith 2025-03-23 10:16:20 +00:00
parent c617364d15
commit cfa3c5884d

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
}