summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-12-04 20:51:19 -0600
committerDenis Kenzior <denkenz@gmail.com>2009-12-04 20:51:19 -0600
commit5745292ccad88791da6363755bd3d1e2e2103ef8 (patch)
tree3685467f43560c3e441b375b9368a90684fd3df4 /src/main.c
parentadfb6c9d603e392f53113e9b7aa525edda0bb624 (diff)
downloadofono-5745292ccad88791da6363755bd3d1e2e2103ef8.tar.gz
Don't generate multiple g_sources, 1 is enough
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index fd8fd1db..c7ed0485 100644
--- a/src/main.c
+++ b/src/main.c
@@ -51,6 +51,7 @@ static gboolean quit_eventloop(gpointer user_data)
static gboolean signal_cb(GIOChannel *channel, GIOCondition cond, gpointer data)
{
+ static int terminated = 0;
int signal_fd = GPOINTER_TO_INT(data);
struct signalfd_siginfo si;
ssize_t res;
@@ -65,9 +66,13 @@ static gboolean signal_cb(GIOChannel *channel, GIOCondition cond, gpointer data)
switch (si.ssi_signo) {
case SIGINT:
case SIGTERM:
- g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS,
- quit_eventloop, NULL);
- __ofono_modem_shutdown();
+ if (terminated == 0) {
+ g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS,
+ quit_eventloop, NULL);
+ __ofono_modem_shutdown();
+ }
+
+ terminated++;
break;
case SIGUSR2:
__ofono_toggle_debug();