aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmicli
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-11-30 11:22:02 +0100
committerAleksander Morgado <aleksander@aleksander.es>2016-11-30 11:22:02 +0100
commitf64a5a06c8602b288016be9c69e2b1306e91b63a (patch)
tree05a6e7580f10a2b17d256584748df45e40cf8ed4 /src/qmicli
parent7b14d888e328be7f518cf41c71d2502468307e08 (diff)
downloadexternal_libqmi-f64a5a06c8602b288016be9c69e2b1306e91b63a.zip
external_libqmi-f64a5a06c8602b288016be9c69e2b1306e91b63a.tar.gz
external_libqmi-f64a5a06c8602b288016be9c69e2b1306e91b63a.tar.bz2
qmicli: use G_SOURCE_CONTINUE to reset the unix signal handler
Diffstat (limited to 'src/qmicli')
-rw-r--r--src/qmicli/qmicli.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c
index 22d5ed7..e9821fe 100644
--- a/src/qmicli/qmicli.c
+++ b/src/qmicli/qmicli.c
@@ -133,7 +133,7 @@ static GOptionEntry main_entries[] = {
};
static gboolean
-signals_handler (gpointer psignum)
+signals_handler (void)
{
if (cancellable) {
/* Ignore consecutive requests of cancellation */
@@ -142,8 +142,7 @@ signals_handler (gpointer psignum)
g_cancellable_cancel (cancellable);
/* Re-set the signal handler to allow main loop cancellation on
* second signal */
- g_unix_signal_add (GPOINTER_TO_INT (psignum), (GSourceFunc) signals_handler, psignum);
- return FALSE;
+ return G_SOURCE_CONTINUE;
}
}
@@ -151,7 +150,7 @@ signals_handler (gpointer psignum)
g_printerr ("cancelling the main loop...\n");
g_idle_add ((GSourceFunc) g_main_loop_quit, loop);
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void
@@ -770,9 +769,9 @@ int main (int argc, char **argv)
loop = g_main_loop_new (NULL, FALSE);
/* Setup signals */
- g_unix_signal_add (SIGINT, (GSourceFunc)signals_handler, GUINT_TO_POINTER (SIGINT));
- g_unix_signal_add (SIGHUP, (GSourceFunc)signals_handler, GUINT_TO_POINTER (SIGHUP));
- g_unix_signal_add (SIGTERM, (GSourceFunc)signals_handler, GUINT_TO_POINTER (SIGTERM));
+ g_unix_signal_add (SIGINT, (GSourceFunc) signals_handler, NULL);
+ g_unix_signal_add (SIGHUP, (GSourceFunc) signals_handler, NULL);
+ g_unix_signal_add (SIGTERM, (GSourceFunc) signals_handler, NULL);
/* Launch QmiDevice creation */
qmi_device_new (file,