diff options
author | Will Thompson <will@willthompson.co.uk> | 2013-12-05 21:10:57 +0000 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2013-12-05 21:10:57 +0000 |
commit | 04d447fe2f987bcf91d9bb64cf346773dab15e09 (patch) | |
tree | 9481b9ab13a8e636d4e0704a0d92a07d460d6c1c /c-sources/pcap-monitor.c | |
parent | b26d40212d3acf239c7fdcfeb4a8ca611bfc17a9 (diff) |
Give a nice error if DBUS_SESSION_BUS_ADDRESS is blank
Diffstat (limited to 'c-sources/pcap-monitor.c')
-rw-r--r-- | c-sources/pcap-monitor.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/c-sources/pcap-monitor.c b/c-sources/pcap-monitor.c index f2acbd8..c9623ae 100644 --- a/c-sources/pcap-monitor.c +++ b/c-sources/pcap-monitor.c @@ -460,6 +460,20 @@ initable_init ( return FALSE; } + if (*address == '\0') + { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_FAILED, + "Failed to look up the %s bus address. %s", + priv->bus_type == G_BUS_TYPE_SESSION ? "session" : "system", + priv->bus_type == G_BUS_TYPE_SESSION + ? "Is DBUS_SESSION_BUS_ADDRESS properly set?" + : ""); + g_free (address); + return FALSE; + } + priv->connection = g_dbus_connection_new_for_address_sync (address, G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION, |