mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
[client] UI Refactor Icon Paths (#3420)
[client] UI Refactor Icon Paths (#3420)
This commit is contained in:
26
client/ui/process/process_nonwindows.go
Normal file
26
client/ui/process/process_nonwindows.go
Normal file
@@ -0,0 +1,26 @@
|
||||
//go:build !windows
|
||||
|
||||
package process
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/process"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func isProcessOwnedByCurrentUser(p *process.Process) bool {
|
||||
currentUserID := os.Getuid()
|
||||
uids, err := p.Uids()
|
||||
if err != nil {
|
||||
log.Errorf("get process uids: %v", err)
|
||||
return false
|
||||
}
|
||||
for _, id := range uids {
|
||||
log.Debugf("checking process uid: %d", id)
|
||||
if int(id) == currentUserID {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user