diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-12-06 04:21:37 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-12-06 04:21:37 +0900 |
| commit | 8d0573405a8a58a57c39b008150d75d3be2894c2 (patch) | |
| tree | db64f6990a74e4e2007162634170a30ad86dc10f /helper/bwrap.go | |
| parent | 38e92edb8efd7cc74031d013a13af5c1c8ddd284 (diff) | |
helper/bwrap: implement sync fd
This is required by wayland security-context-v1.
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'helper/bwrap.go')
| -rw-r--r-- | helper/bwrap.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/helper/bwrap.go b/helper/bwrap.go index d5255564..2788dbf9 100644 --- a/helper/bwrap.go +++ b/helper/bwrap.go @@ -3,6 +3,7 @@ package helper import ( "errors" "io" + "os" "os/exec" "strconv" "sync" @@ -19,6 +20,8 @@ type bubblewrap struct { // bwrap pipes p *pipes + // sync pipe + sync *os.File // returns an array of arguments passed directly // to the child process spawned by bwrap argF func(argsFD, statFD int) []string @@ -72,6 +75,11 @@ func (b *bubblewrap) StartNotify(ready chan error) error { b.Cmd.Env = append(b.Cmd.Env, FortifyHelper+"=1", FortifyStatus+"=-1") } + if b.sync != nil { + b.Cmd.Args = append(b.Cmd.Args, "--sync-fd", strconv.Itoa(3+len(b.Cmd.ExtraFiles))) + b.Cmd.ExtraFiles = append(b.Cmd.ExtraFiles, b.sync) + } + if err := b.Cmd.Start(); err != nil { return err } @@ -131,6 +139,7 @@ func NewBwrap(conf *bwrap.Config, wt io.WriterTo, name string, argF func(argsFD, b.p = &pipes{args: args} } + b.sync = conf.Sync() b.argF = argF b.name = name if wt != nil { |
