aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/params.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-23 00:16:46 +0900
committerOphestra <cat@gensokyo.uk>2025-08-23 00:16:46 +0900
commitea1e3ebae993a3d89302940dc1649b627c420aa1 (patch)
tree14bc57e3b04cde10394174c407c836d4ed25b113 /container/params.go
parent1c692bfb7926c0f28cf7f38ca7b49f4941fd2b90 (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'container/params.go')
-rw-r--r--container/params.go6
1 files changed, 3 insertions, 3 deletions
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()
}
}
}