From 01b0cfe2055e23cf03870d9a9f60648037b4005e Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 23:30:08 +0200 Subject: tests run on OpenBSD; a tool's error message survives one large write; lock pids beyond 32 bits name no process --- internal/lock/lock.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'internal/lock/lock.go') diff --git a/internal/lock/lock.go b/internal/lock/lock.go index 462b26e..2b98227 100644 --- a/internal/lock/lock.go +++ b/internal/lock/lock.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "io/fs" + "math" "os" "path/filepath" "strconv" @@ -156,8 +157,10 @@ func parsePid(s string) (int, bool) { } // running reports whether pid names a process that is currently running. +// A pid outside the kernel's 32-bit range names no process: kill(2) would +// cut it to its low bits and ask about another one. func running(pid int) bool { - if pid <= 0 { + if pid <= 0 || pid > math.MaxInt32 { return false } proc, err := os.FindProcess(pid) -- cgit v1.3