summaryrefslogtreecommitdiff
path: root/src/agent.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-12-17 12:03:59 +0100
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-12-17 12:06:46 +0100
commitcc8adca6972825c5efe819fe96d63460995957f6 (patch)
tree202d0260d2a9a11742e3565acc7011b630321ba4 /src/agent.c
parentb7503542f2ee9f95b3277e099fb5d0cb883c1b9e (diff)
downloadconnman-cc8adca6972825c5efe819fe96d63460995957f6.tar.gz
connman-cc8adca6972825c5efe819fe96d63460995957f6.tar.bz2
connman-cc8adca6972825c5efe819fe96d63460995957f6.zip
agent: Don't crash when no agent was registered on exit
If the user never registered an agent, agent_sender and agent_path are NULL. D-Bus does not handle this gracefully, instead it kills ConnMan. So let's skip the D-Bus part in this case. connmand[4271]: src/agent.c:connman_agent_driver_unregister() Sending release to (null) path (null) iface net.connman.Agent process 4271: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file dbus-message.c line 1198. This is normally a bug in some application using the D-Bus library. D-Bus not built with -rdynamic so unable to print a backtrace connmand[4271]: Aborting (signal 6) [./src/connmand] connmand[4271]: ++++++++ backtrace ++++++++ connmand[4271]: #0 0x3a9920f500 in /lib64/libpthread.so.0 connmand[4271]: #1 0x3a98e36285 in /lib64/libc.so.6 connmand[4271]: #2 0x3a98e37b9b in /lib64/libc.so.6 connmand[4271]: #3 0x3c7602fff5 in /lib64/libdbus-1.so.3 connmand[4271]: #4 0x3c76026fc1 in /lib64/libdbus-1.so.3 connmand[4271]: #5 0x3c76018aea in /lib64/libdbus-1.so.3 connmand[4271]: #6 0x45b8b1 in connman_agent_driver_unregister() at src/agent.c:426 connmand[4271]: #7 0x457b7c in __connman_service_cleanup() at src/service.c:6756 connmand[4271]: #8 0x43f54f in main() at src/main.c:702 connmand[4271]: #9 0x3a98e2169d in /lib64/libc.so.6 connmand[4271]: +++++++++++++++++++++++++++
Diffstat (limited to 'src/agent.c')
-rw-r--r--src/agent.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/agent.c b/src/agent.c
index c08dba8a..3be4b616 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -414,6 +414,9 @@ void connman_agent_driver_unregister(struct connman_agent_driver *driver)
DBG("Unregistering driver %p name %s", driver, driver->name);
+ if (agent_sender == NULL && agent_path == NULL)
+ goto out;
+
for (list = driver_list; list; list = list->next) {
DBusMessage *message;
@@ -440,6 +443,7 @@ void connman_agent_driver_unregister(struct connman_agent_driver *driver)
break;
}
+out:
driver_list = g_slist_remove(driver_list, driver);
}