helper: expose extra files to direct

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-15 02:21:59 +09:00
parent 0f1f0e4364
commit 10a21ce3ef
6 changed files with 40 additions and 40 deletions

View File

@@ -7,7 +7,6 @@ import (
"os/exec"
"slices"
"strconv"
"syscall"
"git.gensokyo.uk/security/fortify/helper/bwrap"
"git.gensokyo.uk/security/fortify/helper/proc"
@@ -26,12 +25,11 @@ func MustNewBwrap(
stat bool,
argF func(argsFd, statFd int) []string,
cmdF func(cmd *exec.Cmd),
conf *bwrap.Config,
setpgid bool,
extraFiles []*os.File,
conf *bwrap.Config,
syncFd *os.File,
) Helper {
b, err := NewBwrap(ctx, name, wt, stat, argF, cmdF, conf, setpgid, extraFiles, syncFd)
b, err := NewBwrap(ctx, name, wt, stat, argF, cmdF, extraFiles, conf, syncFd)
if err != nil {
panic(err.Error())
} else {
@@ -49,15 +47,11 @@ func NewBwrap(
stat bool,
argF func(argsFd, statFd int) []string,
cmdF func(cmd *exec.Cmd),
conf *bwrap.Config,
setpgid bool,
extraFiles []*os.File,
conf *bwrap.Config,
syncFd *os.File,
) (Helper, error) {
b, args := newHelperCmd(ctx, BubblewrapName, wt, stat, argF, extraFiles)
if setpgid {
b.Cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
}
var argsFd uintptr
if v, err := NewCheckedArgs(conf.Args(syncFd, b.extraFiles, &b.files)); err != nil {