aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-09 17:36:36 +0900
committerOphestra <cat@gensokyo.uk>2025-08-09 17:37:46 +0900
commit82608164f66dda428189bdc3610f027820408b49 (patch)
tree8252de6260fcb4d6d050f5c1ca544fe8d2f7544f
parentedd6f2cfa9b08c5c43cea545f9ecc8b5021cf9d6 (diff)
container/params: remove confusingly named error
Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--container/init.go2
-rw-r--r--container/params.go6
-rw-r--r--internal/app/shim_linux.go2
3 files changed, 5 insertions, 5 deletions
diff --git a/container/init.go b/container/init.go
index c8274317..0ede1d7f 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, &params, &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 e4328a7b..a5b4f2f1 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 e423b321..8573ad10 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, &params, 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) {