mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Implement review suggestions and fixes
This commit is contained in:
parent
c3d16610a2
commit
e87cae2463
1 changed files with 2 additions and 3 deletions
|
@ -29,7 +29,6 @@ func GetPID(socketInfo socket.Info) (pid int) {
|
|||
}
|
||||
|
||||
// Find PID for the given UID and inode.
|
||||
// uid, inode := socketInfo.GetUIDandInode()
|
||||
pid = findPID(socketInfo.GetUIDandInode())
|
||||
|
||||
// Set the newly found PID on the socket info.
|
||||
|
@ -59,7 +58,7 @@ func findPID(uid, inode int) (pid int) {
|
|||
if ok {
|
||||
// Look through the PIDs in reverse order, because higher/newer PIDs will be more likely to
|
||||
// be searched for.
|
||||
for i := len(pids) - 1; i > 0; i-- {
|
||||
for i := len(pids) - 1; i >= 0; i-- {
|
||||
if findSocketFromPid(pids[i], socketName) {
|
||||
return pids[i]
|
||||
}
|
||||
|
@ -74,7 +73,7 @@ func findPID(uid, inode int) (pid int) {
|
|||
if ok {
|
||||
// Look through the PIDs in reverse order, because higher/newer PIDs will be more likely to
|
||||
// be searched for.
|
||||
for i := len(pids) - 1; i > 0; i-- {
|
||||
for i := len(pids) - 1; i >= 0; i-- {
|
||||
if findSocketFromPid(pids[i], socketName) {
|
||||
return pids[i]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue