diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-10-26 21:05:22 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-10-26 21:05:22 +0200 |
commit | 8163d38c60db3e44815a506883304fdd5a8fce45 (patch) | |
tree | bbd41408ad612a7cb7db8c02b78c29b11782ce42 /vendor/github.com/godbus/dbus/v5/conn.go | |
parent | 22e5dc19b01e813ff73f4a5be2df9c4adf795fd2 (diff) | |
download | podman-8163d38c60db3e44815a506883304fdd5a8fce45.tar.gz podman-8163d38c60db3e44815a506883304fdd5a8fce45.tar.bz2 podman-8163d38c60db3e44815a506883304fdd5a8fce45.zip |
vendor: update godbus to v5.0.6
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'vendor/github.com/godbus/dbus/v5/conn.go')
-rw-r--r-- | vendor/github.com/godbus/dbus/v5/conn.go | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/vendor/github.com/godbus/dbus/v5/conn.go b/vendor/github.com/godbus/dbus/v5/conn.go index cb8966a74..76fc5cde3 100644 --- a/vendor/github.com/godbus/dbus/v5/conn.go +++ b/vendor/github.com/godbus/dbus/v5/conn.go @@ -73,7 +73,7 @@ func SessionBus() (conn *Conn, err error) { return } -func getSessionBusAddress() (string, error) { +func getSessionBusAddress(autolaunch bool) (string, error) { if address := os.Getenv("DBUS_SESSION_BUS_ADDRESS"); address != "" && address != "autolaunch:" { return address, nil @@ -81,12 +81,26 @@ func getSessionBusAddress() (string, error) { os.Setenv("DBUS_SESSION_BUS_ADDRESS", address) return address, nil } + if !autolaunch { + return "", errors.New("dbus: couldn't determine address of session bus") + } return getSessionBusPlatformAddress() } // SessionBusPrivate returns a new private connection to the session bus. func SessionBusPrivate(opts ...ConnOption) (*Conn, error) { - address, err := getSessionBusAddress() + address, err := getSessionBusAddress(true) + if err != nil { + return nil, err + } + + return Dial(address, opts...) +} + +// SessionBusPrivate returns a new private connection to the session bus. If +// the session bus is not already open, do not attempt to launch it. +func SessionBusPrivateNoAutoStartup(opts ...ConnOption) (*Conn, error) { + address, err := getSessionBusAddress(false) if err != nil { return nil, err } @@ -121,7 +135,7 @@ func SystemBus() (conn *Conn, err error) { // ConnectSessionBus connects to the session bus. func ConnectSessionBus(opts ...ConnOption) (*Conn, error) { - address, err := getSessionBusAddress() + address, err := getSessionBusAddress(true) if err != nil { return nil, err } @@ -180,7 +194,7 @@ func Dial(address string, opts ...ConnOption) (*Conn, error) { // // Deprecated: use Dial with options instead. func DialHandler(address string, handler Handler, signalHandler SignalHandler) (*Conn, error) { - return Dial(address, WithSignalHandler(signalHandler)) + return Dial(address, WithHandler(handler), WithSignalHandler(signalHandler)) } // ConnOption is a connection option. |