Verified Commit 04d1eb2d authored by Iain Lane's avatar Iain Lane

binary: Allow quitting early on SIGTERM/SIGINT

Now we're started by systemd, we also need to handle being *stopped* by
systemd too. systemd sends us a SIGTERM to ask us to quit, but we refuse
to exit on SIGTERM if we're not fully running. That's a problem if the
SIGTERM is sent early in startup. For example, if gnome-shell has exited
due to Wayland not being supported, and we're trying to fall back to
Xorg, the session will not be running at this point, but we want to be
able to kill everything in order to try again with Xorg.

Fix this by looking at the `GError` returned by `gsm_manager_logout()`,
and directly quitting if we're not in the running phase yet.
parent 16f3e738
......@@ -109,9 +109,12 @@ term_or_int_signal_cb (gpointer data)
/* let the fatal signals interrupt us */
g_debug ("Caught SIGINT/SIGTERM, shutting down normally.");
gsm_manager_logout (manager, GSM_MANAGER_LOGOUT_MODE_FORCE, &error);
if (!gsm_manager_logout (manager, GSM_MANAGER_LOGOUT_MODE_FORCE, &error)) {
if (g_error_matches (error, GSM_MANAGER_ERROR, GSM_MANAGER_ERROR_NOT_IN_RUNNING)) {
gsm_quit ();
return FALSE;
}
if (error != NULL) {
g_critical ("Failed to log out: %s", error->message);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment