Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion interpreter/apmint/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"fmt"
"io/fs"
"os"
"path"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -46,7 +47,7 @@ func openAPMAgentSocket(pid libpf.PID, socketPath string) (*apmAgentSocket, erro
}

// Prepend root system to ensure that this also works with containerized apps.
socketPath = fmt.Sprintf("/proc/%d/root/%s", pid, socketPath)
socketPath = path.Join("/proc", strconv.Itoa(int(pid)), "root", socketPath)

// Read effective UID/GID of the APM agent process.
euid, egid, err := readProcessOwner(pid)
Expand Down
5 changes: 3 additions & 2 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"fmt"
"io"
"os"
"path"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -330,9 +331,9 @@ func (sp *systemProcess) OpenELF(file string) (*pfelf.File, error) {
}

// Fall back to opening the file using the process specific root
return pfelf.Open(fmt.Sprintf("/proc/%v/root/%s", sp.pid, file))
return pfelf.Open(path.Join("/proc", strconv.Itoa(int(sp.pid)), "root", file))
}

func (sp *systemProcess) ExtractAsFile(file string) (string, error) {
return fmt.Sprintf("/proc/%v/root/%s", sp.pid, file), nil
return path.Join("/proc", strconv.Itoa(int(sp.pid)), "root", file), nil
}