Merge pull request #68 from safing/feature/clean-linux-process-paths

Remove " (deleted)" suffix on linux for deleted files
This commit is contained in:
Patrick Pacher 2020-06-04 08:00:59 +02:00 committed by GitHub
commit b8a12f8b9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import (
"fmt"
"path/filepath"
"runtime"
"strings"
"sync"
"time"
@ -15,6 +16,10 @@ import (
"github.com/safing/portmaster/profile"
)
const (
onLinux = runtime.GOOS == "linux"
)
var (
dupReqMap = make(map[int]*sync.WaitGroup)
dupReqLock sync.Mutex
@ -263,6 +268,10 @@ func loadProcess(ctx context.Context, pid int) (*Process, error) {
if err != nil {
return nil, fmt.Errorf("failed to get Path for p%d: %s", pid, err)
}
// remove linux " (deleted)" suffix for deleted files
if onLinux {
new.Path = strings.TrimSuffix(new.Path, " (deleted)")
}
// Executable Name
_, new.ExecName = filepath.Split(new.Path)