diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-14 21:43:34 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-14 21:43:34 +0900 |
| commit | 45953b3d9c250658767aa6bb673422f8d954b950 (patch) | |
| tree | 9edebe77558c585c5b8d8c41db7957bf12058b72 /ldd/exec.go | |
| parent | 42759e7a9f4e6c45d2e043a404e444160e6cddba (diff) | |
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 <cat@gensokyo.uk>
Diffstat (limited to 'ldd/exec.go')
| -rw-r--r-- | ldd/exec.go | 5 |
1 files changed, 5 insertions, 0 deletions
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)) { |
