From ea1e3ebae993a3d89302940dc1649b627c420aa1 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 23 Aug 2025 00:16:46 +0900 Subject: container/params: pass fd instead of file The file is very difficult to stub. Pass fd instead as it is the value that is actually useful. Signed-off-by: Ophestra --- container/params.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'container/params.go') diff --git a/container/params.go b/container/params.go index 09be3707..00c98cf8 100644 --- a/container/params.go +++ b/container/params.go @@ -25,7 +25,7 @@ func Setup(extraFiles *[]*os.File) (int, *gob.Encoder, error) { } // Receive retrieves setup fd from the environment and receives params. -func Receive(key string, e any, v **os.File) (func() error, error) { +func Receive(key string, e any, fdp *uintptr) (func() error, error) { var setup *os.File if s, ok := os.LookupEnv(key); !ok { @@ -38,8 +38,8 @@ func Receive(key string, e any, v **os.File) (func() error, error) { if setup == nil { return nil, syscall.EBADF } - if v != nil { - *v = setup + if fdp != nil { + *fdp = setup.Fd() } } } -- cgit v1.3.1