From d22145a3926de9710d5bd76ddfde093baca0b51d Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 12 Mar 2025 23:29:43 +0900 Subject: [PATCH] ldd: handle musl static behaviour Signed-off-by: Ophestra --- ldd/exec.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ldd/exec.go b/ldd/exec.go index 3eb9493..5c51c6a 100644 --- a/ldd/exec.go +++ b/ldd/exec.go @@ -14,6 +14,7 @@ import ( const lddTimeout = 2 * time.Second var ( + msgStatic = []byte("Not a valid dynamic program") msgStaticGlibc = []byte("not a dynamic executable") ) @@ -46,7 +47,8 @@ func Exec(ctx context.Context, p string) ([]*Entry, error) { } if err := h.Wait(); err != nil { m := stderr.Bytes() - if bytes.Contains(m, msgStaticGlibc) { + if bytes.Contains(m, append([]byte(p+": "), msgStatic...)) || + bytes.Contains(m, msgStaticGlibc) { return nil, nil }