mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 16:00:21 +01:00
dispatcher: setup signal handler as first
The very first and the very last thing we want to do is register (unregister) the signal handler.
This commit is contained in:
parent
33b643414f
commit
e21db61b6d
1 changed files with 6 additions and 5 deletions
|
|
@ -996,15 +996,15 @@ main(int argc, char **argv)
|
|||
guint dbus_regist_id = 0;
|
||||
guint dbus_own_name_id = 0;
|
||||
|
||||
source_term = nm_g_unix_signal_add_source(SIGTERM, signal_handler, GINT_TO_POINTER(SIGTERM));
|
||||
source_int = nm_g_unix_signal_add_source(SIGINT, signal_handler, GINT_TO_POINTER(SIGINT));
|
||||
|
||||
if (!parse_command_line(&argc, &argv, &error)) {
|
||||
_LOG_X_W("Error parsing command line arguments: %s", error->message);
|
||||
gl.exit_with_failure = TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
source_term = nm_g_unix_signal_add_source(SIGTERM, signal_handler, GINT_TO_POINTER(SIGTERM));
|
||||
source_int = nm_g_unix_signal_add_source(SIGINT, signal_handler, GINT_TO_POINTER(SIGINT));
|
||||
|
||||
if (gl.debug) {
|
||||
if (!g_getenv("G_MESSAGES_DEBUG")) {
|
||||
/* we log our regular messages using g_debug() and g_info().
|
||||
|
|
@ -1084,13 +1084,14 @@ done:
|
|||
|
||||
nm_clear_pointer(&gl.requests_waiting, g_queue_free);
|
||||
|
||||
nm_clear_g_source_inst(&source_term);
|
||||
nm_clear_g_source_inst(&source_int);
|
||||
nm_clear_g_source_inst(&gl.quit_source);
|
||||
g_clear_object(&gl.dbus_connection);
|
||||
|
||||
if (!gl.debug)
|
||||
logging_shutdown();
|
||||
|
||||
nm_clear_g_source_inst(&source_term);
|
||||
nm_clear_g_source_inst(&source_int);
|
||||
|
||||
return gl.exit_with_failure ? 1 : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue