summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-01-25 13:45:22 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-01-29 09:13:25 +1030
commitf0ba7707161b8866e6fde32d6f25be6afcdecb48 (patch)
treead3fd14c3ddd6456774e36aac7ce475943c89c86
parent2cb0ebec2b85d96289c23c17cfdcdf97ef6877d2 (diff)
config: only shutdown libhal if the connection is valid.
Thanks to libdbus' extensive use of assert we won't just get an error, it'll bring the whole server down for us. (cherry picked from commit fb07fab2c07e7b0834724541dc47bfba02ba8574)
-rw-r--r--config/hal.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/config/hal.c b/config/hal.c
index 52a011333..1575422c3 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -283,12 +283,14 @@ disconnect_hook(void *data)
struct config_hal_info *info = data;
if (info->hal_ctx) {
- dbus_error_init(&error);
- if (!libhal_ctx_shutdown(info->hal_ctx, &error))
- DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
- error.name, error.message);
+ if (dbus_connection_get_is_connected(info->system_bus)) {
+ dbus_error_init(&error);
+ if (!libhal_ctx_shutdown(info->hal_ctx, &error))
+ DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ }
libhal_ctx_free(info->hal_ctx);
- dbus_error_free(&error);
}
info->hal_ctx = NULL;