aboutsummaryrefslogtreecommitdiffhomepage
path: root/ldd/exec.go
diff options
context:
space:
mode:
Diffstat (limited to 'ldd/exec.go')
-rw-r--r--ldd/exec.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/ldd/exec.go b/ldd/exec.go
index bbcf2958..c0b40655 100644
--- a/ldd/exec.go
+++ b/ldd/exec.go
@@ -36,7 +36,19 @@ const (
// [os.SyscallError] for fault creating the stdout pipe,
// [container.StartError] for fault during either stage of container setup.
// Otherwise, it passes through the return values of [Decoder.Decode].
-func Resolve(ctx context.Context, msg message.Msg, pathname *check.Absolute) ([]*Entry, error) {
+func Resolve(
+ ctx context.Context,
+ msg message.Msg,
+ pathname *check.Absolute,
+) ([]*Entry, error) {
+ if pathname == nil {
+ if p, err := os.Executable(); err != nil {
+ return nil, err
+ } else if pathname, err = check.NewAbs(p); err != nil {
+ return nil, err
+ }
+ }
+
c, cancel := context.WithTimeout(ctx, lddTimeout)
defer cancel()