MCPcopy Create free account
hub / github.com/PasarGuard/node / pathsMatch

Function pathsMatch

backend/xray/process_unix.go:295–320  ·  view source on GitHub ↗

pathsMatch compares two executable paths, resolving symlinks and absolutizing both

(candidate, target string)

Source from the content-addressed store, hash-verified

293
294// pathsMatch compares two executable paths, resolving symlinks and absolutizing both
295func pathsMatch(candidate, target string) bool {
296 if candidate == "" || target == "" {
297 return false
298 }
299
300 candidateAbs, err := filepath.Abs(candidate)
301 if err != nil {
302 return false
303 }
304 targetAbs, err := filepath.Abs(target)
305 if err != nil {
306 return false
307 }
308
309 if candidateAbs == targetAbs {
310 return true
311 }
312
313 candidateReal, errA := filepath.EvalSymlinks(candidateAbs)
314 targetReal, errB := filepath.EvalSymlinks(targetAbs)
315 if errA == nil && errB == nil && candidateReal == targetReal {
316 return true
317 }
318
319 return false
320}

Callers 2

findXrayProcessesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected