aboutsummaryrefslogtreecommitdiffhomepage
path: root/ldd
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-23 17:46:22 +0900
committerOphestra <cat@gensokyo.uk>2025-02-23 17:46:22 +0900
commit83c8f0488b168be5f374d3ad9eef58dde4d144ef (patch)
tree77c1883f91d849f7ce3b28f89f6fb9ee5f134c8c /ldd
parent478b27922cf9084dc63e4084875f36a5427ba734 (diff)
ldd: pass absolute path to bwrap
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'ldd')
-rw-r--r--ldd/exec.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/ldd/exec.go b/ldd/exec.go
index d605b457..06769373 100644
--- a/ldd/exec.go
+++ b/ldd/exec.go
@@ -3,6 +3,7 @@ package ldd
import (
"context"
"os"
+ "os/exec"
"strings"
"time"
@@ -15,20 +16,20 @@ const lddTimeout = 2 * time.Second
func Exec(ctx context.Context, p string) ([]*Entry, error) {
var h helper.Helper
- if b, err := helper.NewBwrap(
+ if toolPath, err := exec.LookPath("ldd"); err != nil {
+ return nil, err
+ } else if h, err = helper.NewBwrap(
(&bwrap.Config{
Hostname: "fortify-ldd",
Chdir: "/",
Syscall: &bwrap.SyscallPolicy{DenyDevel: true, Multiarch: true},
NewSession: true,
DieWithParent: true,
- }).Bind("/", "/").DevTmpfs("/dev"), "ldd",
+ }).Bind("/", "/").DevTmpfs("/dev"), toolPath,
nil, func(_, _ int) []string { return []string{p} },
nil, nil,
); err != nil {
return nil, err
- } else {
- h = b
}
stdout := new(strings.Builder)