Skip to content

Commit

Permalink
abs
Browse files Browse the repository at this point in the history
  • Loading branch information
sclevine committed Dec 16, 2024
1 parent 7d6b15e commit 7a590f9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/autoupdate/agent/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ func IsEnabled() (bool, error) {
if err != nil {
return false, trace.Wrap(err, "cannot find Teleport binary")
}
if !strings.HasPrefix(teleportPath, teleportOptDir) {
updaterBasePath := filepath.Clean(teleportOptDir) + "/"
absPath, err := filepath.Abs(teleportPath)
if err != nil {
return false, trace.Wrap(err, "cannot get absolute path for Teleport binary")
}
if !strings.HasPrefix(absPath, updaterBasePath) {
return false, nil
}
systemDir := filepath.Join(teleportOptDir, systemNamespace)
return !strings.HasPrefix(teleportPath, systemDir), nil
return !strings.HasPrefix(absPath, systemDir), nil
}

0 comments on commit 7a590f9

Please sign in to comment.