diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-03-30 18:15:56 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-03-30 18:24:53 +0900 |
| commit | a6600be34ad812ff13c89f45c3cadaac6d994e67 (patch) | |
| tree | 48c8cd6daab8084eb9391c7ee16f2b38f1cf280f /container/initdev.go | |
| parent | b5592633f5b980970808fc5be43b0fb4f4d4e784 (diff) | |
all: use filepath
This makes package check portable, and removes nonportable behaviour from package pkg, pipewire, and system. All other packages remain nonportable due to their nature. No latency increase was observed due to this change on amd64 and arm64 linux.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/initdev.go')
| -rw-r--r-- | container/initdev.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/container/initdev.go b/container/initdev.go index 38cb6e18..0847f587 100644 --- a/container/initdev.go +++ b/container/initdev.go @@ -3,7 +3,7 @@ package container import ( "encoding/gob" "fmt" - "path" + "path/filepath" . "syscall" "hakurei.app/check" @@ -46,7 +46,7 @@ func (d *MountDevOp) apply(state *setupState, k syscallDispatcher) error { } for _, name := range []string{"null", "zero", "full", "random", "urandom", "tty"} { - targetPath := path.Join(target, name) + targetPath := filepath.Join(target, name) if err := k.ensureFile(targetPath, 0444, state.ParentPerm); err != nil { return err } @@ -62,7 +62,7 @@ func (d *MountDevOp) apply(state *setupState, k syscallDispatcher) error { for i, name := range []string{"stdin", "stdout", "stderr"} { if err := k.symlink( fhs.Proc+"self/fd/"+string(rune(i+'0')), - path.Join(target, name), + filepath.Join(target, name), ); err != nil { return err } @@ -72,13 +72,13 @@ func (d *MountDevOp) apply(state *setupState, k syscallDispatcher) error { {fhs.Proc + "kcore", "core"}, {"pts/ptmx", "ptmx"}, } { - if err := k.symlink(pair[0], path.Join(target, pair[1])); err != nil { + if err := k.symlink(pair[0], filepath.Join(target, pair[1])); err != nil { return err } } - devShmPath := path.Join(target, "shm") - devPtsPath := path.Join(target, "pts") + devShmPath := filepath.Join(target, "shm") + devPtsPath := filepath.Join(target, "pts") for _, name := range []string{devShmPath, devPtsPath} { if err := k.mkdir(name, state.ParentPerm); err != nil { return err @@ -92,7 +92,7 @@ func (d *MountDevOp) apply(state *setupState, k syscallDispatcher) error { if state.RetainSession { if k.isatty(Stdout) { - consolePath := path.Join(target, "console") + consolePath := filepath.Join(target, "console") if err := k.ensureFile(consolePath, 0444, state.ParentPerm); err != nil { return err } @@ -110,7 +110,7 @@ func (d *MountDevOp) apply(state *setupState, k syscallDispatcher) error { } if d.Mqueue { - mqueueTarget := path.Join(target, "mqueue") + mqueueTarget := filepath.Join(target, "mqueue") if err := k.mkdir(mqueueTarget, state.ParentPerm); err != nil { return err } |
