helper/bwrap: move sync to helper state
All checks were successful
Build / Create distribution (push) Successful in 1m25s
Test / Run NixOS test (push) Successful in 3m33s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-01-19 18:38:13 +09:00
parent cae567c109
commit 2f70506865
10 changed files with 76 additions and 74 deletions

View File

@@ -62,8 +62,9 @@ func Main() {
}
// restore bwrap sync fd
var syncFd *os.File
if payload.Sync != nil {
payload.Bwrap.SetSync(os.NewFile(*payload.Sync, "sync"))
syncFd = os.NewFile(*payload.Sync, "sync")
}
// close setup socket
@@ -134,8 +135,11 @@ func Main() {
conf.Symlink("fortify", innerInit)
helper.BubblewrapName = payload.Exec[0] // resolved bwrap path by parent
if b, err := helper.NewBwrap(conf, nil, innerInit,
func(int, int) []string { return make([]string, 0) }); err != nil {
if b, err := helper.NewBwrap(
conf, innerInit,
nil, func(int, int) []string { return make([]string, 0) },
syncFd,
); err != nil {
fmsg.Fatalf("malformed sandbox config: %v", err)
} else {
cmd := b.Unwrap()