From 45953b3d9c250658767aa6bb673422f8d954b950 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 14 Nov 2025 21:43:34 +0900 Subject: ldd: cancel on decoder error This prevents blocking from failures caused by ldd(1) emitting output that is not anticipated by the decoder. Signed-off-by: Ophestra --- ldd/exec.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ldd/exec.go') diff --git a/ldd/exec.go b/ldd/exec.go index d91cd652..959a3f43 100644 --- a/ldd/exec.go +++ b/ldd/exec.go @@ -68,6 +68,11 @@ func Exec(ctx context.Context, msg message.Msg, p string) ([]*Entry, error) { } entries, decodeErr := d.Decode() + if decodeErr != nil { + // do not cancel on successful decode to avoid racing with ldd(1) termination + cancel() + } + if err := z.Wait(); err != nil { m := stderr.Bytes() if bytes.Contains(m, []byte(msgStaticSuffix)) || bytes.Contains(m, []byte(msgStaticGlibc)) { -- cgit v1.3.1