(7) add set_signal_handlers() to bind functions during init
[systembsd.git] / src / interfaces / localed / localed.c
index 83c8de2ba82c5eeda61bac6433e8841bbee970e7..27448acb59e0fa832ffb56a44ff6c6dca578a975 100644 (file)
@@ -142,6 +142,14 @@ gboolean unix_sig_terminate_handler(gpointer data) {
        return G_SOURCE_REMOVE;
 }
 
+void set_signal_handlers() {
+
+    /* we don't care about its descriptor, we never need to unregister these */
+    g_unix_signal_add(SIGINT,  unix_sig_terminate_handler, NULL);
+    g_unix_signal_add(SIGHUP,  unix_sig_terminate_handler, NULL);
+    g_unix_signal_add(SIGTERM, unix_sig_terminate_handler, NULL);
+}
+
 int main() {
 
        localed_loop = g_main_loop_new(NULL, TRUE);