aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/inittmpfs.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-29 02:15:48 +0900
committerOphestra <cat@gensokyo.uk>2025-08-29 02:15:48 +0900
commit8d472ebf2b654e0b97b21b40a4333184fc2c0736 (patch)
treeda8917f72d6b19e4efdd8b4031f1ff19baf1c42d /container/inittmpfs.go
parent4da6463135f63658365d837e8d7dd69f0ca1468e (diff)
container/inittmpfs: unwrap out of bounds error
This eliminates generic WrapErr from tmpfs. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/inittmpfs.go')
-rw-r--r--container/inittmpfs.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/container/inittmpfs.go b/container/inittmpfs.go
index 0d50e463..2835004a 100644
--- a/container/inittmpfs.go
+++ b/container/inittmpfs.go
@@ -3,14 +3,20 @@ package container
import (
"encoding/gob"
"fmt"
- "io/fs"
"math"
"os"
+ "strconv"
. "syscall"
)
func init() { gob.Register(new(MountTmpfsOp)) }
+type TmpfsSizeError int
+
+func (e TmpfsSizeError) Error() string {
+ return "tmpfs size " + strconv.Itoa(int(e)) + " out of bounds"
+}
+
// Tmpfs appends an [Op] that mounts tmpfs on container path [MountTmpfsOp.Path].
func (f *Ops) Tmpfs(target *Absolute, size int, perm os.FileMode) *Ops {
*f = append(*f, &MountTmpfsOp{SourceTmpfsEphemeral, target, MS_NOSUID | MS_NODEV, size, perm})
@@ -36,7 +42,7 @@ func (t *MountTmpfsOp) Valid() bool { return t !=
func (t *MountTmpfsOp) early(*setupState, syscallDispatcher) error { return nil }
func (t *MountTmpfsOp) apply(_ *setupState, k syscallDispatcher) error {
if t.Size < 0 || t.Size > math.MaxUint>>1 {
- return msg.WrapErr(fs.ErrInvalid, fmt.Sprintf("size %d out of bounds", t.Size))
+ return TmpfsSizeError(t.Size)
}
return k.mountTmpfs(t.FSName, toSysroot(t.Path.String()), t.Flags, t.Size, t.Perm)
}