diff --git a/src/main.c b/src/main.c index bae586d..1a669fc 100644 --- a/src/main.c +++ b/src/main.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "fprintd.h" @@ -129,6 +130,14 @@ static const GOptionEntry entries[] = { { NULL } }; +static gboolean sigterm_callback(gpointer data) +{ + GMainLoop *loop = data; + + g_main_loop_quit (loop); + return FALSE; +} + int main(int argc, char **argv) { GOptionContext *context; @@ -178,6 +187,7 @@ int main(int argc, char **argv) store.init (); loop = g_main_loop_new(NULL, FALSE); + g_unix_signal_add (SIGTERM, sigterm_callback, loop); g_debug("Launching FprintObject"); diff --git a/tests/fprintd.py b/tests/fprintd.py index 60d85de..eeb632a 100755 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -233,7 +233,7 @@ class FPrintdTest(dbusmock.DBusTestCase): self.daemon.terminate() except OSError: pass - self.daemon.wait() + self.daemon.wait(timeout=2) self.daemon = None self.client = None