diff --git a/portlist/portlist.go b/portlist/portlist.go index 81c1664a7..9f7af40d0 100644 --- a/portlist/portlist.go +++ b/portlist/portlist.go @@ -17,8 +17,8 @@ import ( type Port struct { Proto string // "tcp" or "udp" Port uint16 // port number - Process string // optional process name, if found - Pid int // process id, if known + Process string // optional process name, if found (requires suitable permissions) + Pid int // process ID, if known (requires suitable permissions) } // List is a list of Ports. diff --git a/portlist/portlist_linux.go b/portlist/portlist_linux.go index eb1e53f9e..68b8ed7ba 100644 --- a/portlist/portlist_linux.go +++ b/portlist/portlist_linux.go @@ -322,6 +322,8 @@ func (li *linuxImpl) findProcessNames(need map[string]*portMeta) error { pe.pid = int(p) } pe.port.Process = argvSubject(argv...) + pid64, _ := mem.ParseInt(pid, 10, 0) + pe.port.Pid = int(pid64) pe.needsProcName = false delete(need, string(targetBuf[:n])) if len(need) == 0 {