summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2012-02-02 14:31:28 +0000
committerRichard Hughes <richard@hughsie.com>2012-02-02 14:31:28 +0000
commit01935469067747e6c0093988780d8a593837fee3 (patch)
tree82d0bcb0fe9a31f03b0e71caa9112c4271919d29 /src
parent867cdb9d4b33a18f4e30776697f5f350177c847a (diff)
Don't crash when the system bus isn't available, just abort with an error
Diffstat (limited to 'src')
-rw-r--r--src/pk-dbus.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pk-dbus.c b/src/pk-dbus.c
index 6ea4bf11..dde437f9 100644
--- a/src/pk-dbus.c
+++ b/src/pk-dbus.c
@@ -296,7 +296,14 @@ pk_dbus_init (PkDbus *dbus)
dbus->priv = PK_DBUS_GET_PRIVATE (dbus);
/* use the bus to get the uid */
- dbus->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+ dbus->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM,
+ NULL, &error);
+ if (dbus->priv->connection == NULL) {
+ g_warning ("cannot connect to the system bus: %s",
+ error->message);
+ g_error_free (error);
+ return;
+ }
/* connect to DBus so we can get the pid */
dbus->priv->proxy_pid =