Use findLibraryByPid

This commit is contained in:
M. Mert Yildiran 2022-06-03 00:07:30 +03:00
parent 46f3d290b0
commit e99749d75a
No known key found for this signature in database
GPG Key ID: D42ADB236521BF7A
2 changed files with 2 additions and 4 deletions

View File

@ -46,7 +46,7 @@ func findLibraryByPid(procfs string, pid uint32, libraryName string) (string, er
filepath := parts[5]
if !strings.Contains(filepath, libraryName) {
if libraryName != "" && !strings.Contains(filepath, libraryName) {
continue
}

View File

@ -1,8 +1,6 @@
package tlstapper
import (
"fmt"
"os"
"strconv"
"sync"
@ -196,7 +194,7 @@ func (t *TlsTapper) tapSsllibPid(pid uint32, sslLibrary string, namespace string
}
func (t *TlsTapper) tapGolangPid(procfs string, pid uint32, namespace string) error {
exePath, err := os.Readlink(fmt.Sprintf("%s/%d/exe", procfs, pid))
exePath, err := findLibraryByPid(procfs, pid, "")
if err != nil {
return err
}