diff options
author | Bertrand SIMONNET <bsimonnet@google.com> | 2015-12-18 16:15:25 -0800 |
---|---|---|
committer | Bertrand SIMONNET <bsimonnet@google.com> | 2015-12-18 16:17:33 -0800 |
commit | e8c9b8a8e340a612b4a0a24901526982aa17d61f (patch) | |
tree | 58fca58532ab5edfc9ef442779dd2913c37a1e1f | |
parent | beeafcd9a08682077dc086fe1d96dee6f3b60fd2 (diff) | |
download | dbus-e8c9b8a8e340a612b4a0a24901526982aa17d61f.tar.gz |
dbus: Raise SIGTERM when the connection drops.
Instead of exiting directly when a client notices that the connection
got dropped, raise a SIGTERM signal to allow the client to clean up and
exit cleanly.
Bug: 26267381
Test: stop dbus. Clients exit cleanly.
Change-Id: I7e1faf1aa8b761b1b05dfde82a48882f61124acb
-rw-r--r-- | dbus/dbus-connection.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index fb529554..03622882 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -22,6 +22,7 @@ */ #include <config.h> +#include <signal.h> #include "dbus-shared.h" #include "dbus-connection.h" #include "dbus-list.h" @@ -4284,8 +4285,13 @@ _dbus_connection_update_dispatch_status_and_unlock (DBusConnection *connectio CONNECTION_UNLOCK (connection); _dbus_verbose ("Exiting on Disconnected signal\n"); - _dbus_exit (1); - _dbus_assert_not_reached ("Call to exit() returned"); + if (raise (SIGTERM) != 0) + { + _dbus_verbose ("Failed to raise a SIGTERM signal. Exiting\n"); + _dbus_exit (1); + _dbus_assert_not_reached ("Call to exit() returned"); + } + return; } } |