aboutsummaryrefslogtreecommitdiffhomepage
path: root/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus_test.go2
-rw-r--r--dbus/run.go11
2 files changed, 9 insertions, 4 deletions
diff --git a/dbus/dbus_test.go b/dbus/dbus_test.go
index 28f3c244..098a2179 100644
--- a/dbus/dbus_test.go
+++ b/dbus/dbus_test.go
@@ -164,7 +164,7 @@ func TestProxy_Start_Wait_Close_String(t *testing.T) {
}
t.Run("started string of "+id, func(t *testing.T) {
- wantSubstr := binPath + " --args=3 --fd=4"
+ wantSubstr := binPath + " --args=3"
if got := p.String(); !strings.Contains(got, wantSubstr) {
t.Errorf("String() = %v, want %v",
p.String(), wantSubstr)
diff --git a/dbus/run.go b/dbus/run.go
index 0b8267f8..da0bbc8d 100644
--- a/dbus/run.go
+++ b/dbus/run.go
@@ -3,6 +3,7 @@ package dbus
import (
"errors"
"io"
+ "strconv"
"git.ophivana.moe/cat/fortify/helper"
)
@@ -18,9 +19,13 @@ func (p *Proxy) Start(ready chan error, output io.Writer) error {
}
h := helper.New(p.seal, p.path,
- // Helper: Args is always 3 and status if set is always 4.
- "--args=3",
- "--fd=4",
+ func(argsFD, statFD int) []string {
+ if statFD == -1 {
+ return []string{"--args=" + strconv.Itoa(argsFD)}
+ } else {
+ return []string{"--args=" + strconv.Itoa(argsFD), "--fd=" + strconv.Itoa(statFD)}
+ }
+ },
)
// xdg-dbus-proxy does not need to inherit the environment
h.Env = []string{}