diff --git a/app/dockerdwrapperwithcompose.c b/app/dockerdwrapperwithcompose.c index da648cd..bfaea3c 100644 --- a/app/dockerdwrapperwithcompose.c +++ b/app/dockerdwrapperwithcompose.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -176,28 +177,21 @@ static bool prevent_others_from_using_our_ipc_socket(void) { * * @param signal_num Signal number. */ -static void handle_signals(__attribute__((unused)) int signal_num) { - switch (signal_num) { +static gboolean handle_signals(gpointer signal_num) { + switch (GPOINTER_TO_INT(signal_num)) { case SIGINT: case SIGTERM: - case SIGQUIT: quit_program(EX_OK); } + return G_SOURCE_REMOVE; } /** * @brief Initialize signals */ static void init_signals(void) { - struct sigaction sa; - - sa.sa_flags = 0; - - sigemptyset(&sa.sa_mask); - sa.sa_handler = handle_signals; - sigaction(SIGINT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); - sigaction(SIGQUIT, &sa, NULL); + g_unix_signal_add(SIGINT, handle_signals, GINT_TO_POINTER(SIGINT)); + g_unix_signal_add(SIGTERM, handle_signals, GINT_TO_POINTER(SIGTERM)); } /**