[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Sun, 20 Mar 2022 04:55:22 -0400 (EDT) |
branch: master
commit b60a859f2d8877679dee46ec377478f3a3c0d58d
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Oct 20 15:23:38 2019 +0100
cleanup on signal
---
js/infog/main.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/js/infog/main.c b/js/infog/main.c
index a9c4e64869..e80b95e81a 100644
--- a/js/infog/main.c
+++ b/js/infog/main.c
@@ -7,9 +7,9 @@
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
-
#include <time.h>
#include <stdarg.h>
+#include <signal.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
@@ -49,7 +49,6 @@ static gboolean onkeypress(GtkWidget *webView,
static char *socket_file;
int socket_id;
-/* FIXME - not removed if program killed with C-c. */
static void
remove_socket (void)
{
@@ -581,6 +580,13 @@ build_gui (void)
gtk_widget_grab_focus (GTK_WIDGET(webView));
}
+/* Used to make sure atexit functions run. */
+void
+termination_handler (int signum)
+{
+ exit (0);
+}
+
int
main (int argc, char *argv[])
{
@@ -594,6 +600,14 @@ main (int argc, char *argv[])
return 0;
}
+ if (signal (SIGINT, termination_handler) == SIG_IGN)
+ signal (SIGINT, SIG_IGN);
+ if (signal (SIGHUP, termination_handler) == SIG_IGN)
+ signal (SIGHUP, SIG_IGN);
+ if (signal (SIGTERM, termination_handler) == SIG_IGN)
+ signal (SIGTERM, SIG_IGN);
+
+
/* This is used to use a separate process for the web browser
that looks up the index files. This stops the program from freezing
while the index files are processed. */
- [no subject], (continued)
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject],
Gavin D. Smith <=
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20