mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
9d0d5ea411
Bumps [github.com/godbus/dbus/v5](https://github.com/godbus/dbus) from 5.2.0 to 5.2.2. - [Release notes](https://github.com/godbus/dbus/releases) - [Commits](https://github.com/godbus/dbus/compare/v5.2.0...v5.2.2) --- updated-dependencies: - dependency-name: github.com/godbus/dbus/v5 dependency-version: 5.2.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
41 lines
894 B
Go
41 lines
894 B
Go
//go:build !windows && !solaris && !darwin
|
|
|
|
package dbus
|
|
|
|
import (
|
|
"net"
|
|
"os"
|
|
)
|
|
|
|
const defaultSystemBusAddress = "unix:path=/var/run/dbus/system_bus_socket"
|
|
|
|
func getSystemBusPlatformAddress() string {
|
|
address := os.Getenv("DBUS_SYSTEM_BUS_ADDRESS")
|
|
if address != "" {
|
|
return address
|
|
}
|
|
return defaultSystemBusAddress
|
|
}
|
|
|
|
// DialUnix establishes a new private connection to the message bus specified by UnixConn.
|
|
func DialUnix(conn *net.UnixConn, opts ...ConnOption) (*Conn, error) {
|
|
tr := newUnixTransportFromConn(conn)
|
|
return newConn(tr, opts...)
|
|
}
|
|
|
|
func ConnectUnix(uconn *net.UnixConn, opts ...ConnOption) (*Conn, error) {
|
|
conn, err := DialUnix(uconn, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if err = conn.Auth(conn.auth); err != nil {
|
|
_ = conn.Close()
|
|
return nil, err
|
|
}
|
|
if err = conn.Hello(); err != nil {
|
|
_ = conn.Close()
|
|
return nil, err
|
|
}
|
|
return conn, nil
|
|
}
|