diff audacious/main.c @ 2076:c291952bf462 trunk

[svn] - exit gracefully on SIGINT/SIGTERM.
author nenolod
date Mon, 11 Dec 2006 01:23:47 -0800
parents 4f750b8d0127
children db3172fb53f0
line wrap: on
line diff
--- a/audacious/main.c	Sat Dec 09 02:18:22 2006 -0800
+++ b/audacious/main.c	Mon Dec 11 01:23:47 2006 -0800
@@ -972,6 +972,13 @@
 #endif
 }
 
+/* Handles SIGINT/SIGTERM events gracefully. */
+static void
+sigterm_handler(gint sig)
+{
+    mainwin_quit_cb();
+}
+
 static void
 bmp_setup_logger(void)
 {
@@ -1076,6 +1083,8 @@
         bmp_setup_logger();
 
     signal(SIGPIPE, SIG_IGN);   /* for controlsocket.c */
+    signal(SIGINT,  sigterm_handler);
+    signal(SIGTERM, sigterm_handler);
 
     /* in particular environment (maybe with glibc 2.5), core file
        through signal handler doesn't contain useful back trace. */