diff --git a/container/init.go b/container/init.go index c827431..0ede1d7 100644 --- a/container/init.go +++ b/container/init.go @@ -62,7 +62,7 @@ func Init(prepare func(prefix string), setVerbose func(verbose bool)) { offsetSetup int ) if f, err := Receive(setupEnv, ¶ms, &setupFile); err != nil { - if errors.Is(err, ErrInvalid) { + if errors.Is(err, EBADF) { log.Fatal("invalid setup descriptor") } if errors.Is(err, ErrNotSet) { diff --git a/container/params.go b/container/params.go index e4328a7..a5b4f2f 100644 --- a/container/params.go +++ b/container/params.go @@ -5,11 +5,11 @@ import ( "errors" "os" "strconv" + "syscall" ) var ( - ErrNotSet = errors.New("environment variable not set") - ErrInvalid = errors.New("bad file descriptor") + ErrNotSet = errors.New("environment variable not set") ) // Setup appends the read end of a pipe for setup params transmission and returns its fd. @@ -35,7 +35,7 @@ func Receive(key string, e any, v **os.File) (func() error, error) { } else { setup = os.NewFile(uintptr(fd), "setup") if setup == nil { - return nil, ErrInvalid + return nil, syscall.EBADF } if v != nil { *v = setup diff --git a/internal/app/shim_linux.go b/internal/app/shim_linux.go index e423b32..8573ad1 100644 --- a/internal/app/shim_linux.go +++ b/internal/app/shim_linux.go @@ -64,7 +64,7 @@ func ShimMain() { closeSetup func() error ) if f, err := container.Receive(shimEnv, ¶ms, nil); err != nil { - if errors.Is(err, container.ErrInvalid) { + if errors.Is(err, syscall.EBADF) { log.Fatal("invalid config descriptor") } if errors.Is(err, container.ErrNotSet) {