All checks were successful
Test / Create distribution (push) Successful in 1m2s
Test / Sandbox (push) Successful in 2m41s
Test / Hakurei (push) Successful in 3m40s
Test / ShareFS (push) Successful in 3m42s
Test / Sandbox (race detector) (push) Successful in 5m10s
Test / Hakurei (race detector) (push) Successful in 6m10s
Test / Flake checks (push) Successful in 1m23s
This package is not container-specific. Signed-off-by: Ophestra <cat@gensokyo.uk>
29 lines
468 B
Go
29 lines
468 B
Go
//go:build !close_range
|
|
|
|
package container
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
"syscall"
|
|
|
|
"hakurei.app/fhs"
|
|
)
|
|
|
|
// doCloseOnExec implements ensureCloseOnExec by ranging over proc_pid_fd(5).
|
|
func doCloseOnExec() error {
|
|
entries, err := os.ReadDir(fhs.ProcSelf + "fd/")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
var fd int
|
|
for _, ent := range entries {
|
|
if fd, err = strconv.Atoi(ent.Name()); err != nil {
|
|
return err // not reached
|
|
}
|
|
syscall.CloseOnExec(fd)
|
|
}
|
|
return nil
|
|
}
|