tracker r2959 - in trunk: . src/tracker-extract src/tracker-indexer src/tracker-utils src/trackerd



Author: mr
Date: Tue Feb 24 12:23:10 2009
New Revision: 2959
URL: http://svn.gnome.org/viewvc/tracker?rev=2959&view=rev

Log:
	* src/tracker-extract/tracker-main.c:
	* src/tracker-indexer/tracker-main.c: 
	* src/tracker-utils/tracker-status.c:
	* src/trackerd/tracker-main.c: Don't handle signals SIGSEGV,
	SIGBUS, SIGILL, SIGFPE, SIGABRT, instead let a core file be
	generated for those. We only handle SIGINT, SIGTERM and SIGHUP.
	Fixes NB#102800.


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/tracker-extract/tracker-main.c
   trunk/src/tracker-indexer/tracker-main.c
   trunk/src/tracker-utils/tracker-status.c
   trunk/src/trackerd/tracker-main.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Tue Feb 24 12:23:10 2009
@@ -107,7 +107,7 @@
 DBUS_REQUIRED=0.60
 GLIB_REQUIRED=2.16.0
 PANGO_REQUIRED=1.0.0
-GTK_REQUIRED=2.20.0
+GTK_REQUIRED=2.8.0
 GLADE_REQUIRED=2.5
 QDBM_REQUIRED=1.8
 GMIME_REQUIRED=2.1.0

Modified: trunk/src/tracker-extract/tracker-main.c
==============================================================================
--- trunk/src/tracker-extract/tracker-main.c	(original)
+++ trunk/src/tracker-extract/tracker-main.c	Tue Feb 24 12:23:10 2009
@@ -25,6 +25,7 @@
 #include <time.h>
 #include <stdlib.h>
 #include <locale.h>
+#include <signal.h>
 
 #include <glib.h>
 #include <glib-object.h>
@@ -122,6 +123,51 @@
 	g_free (user_data_dir);
 }
 
+static void
+signal_handler (int signo)
+{
+	static gboolean in_loop = FALSE;
+
+	/* Die if we get re-entrant signals handler calls */
+	if (in_loop) {
+		exit (EXIT_FAILURE);
+	}
+
+	switch (signo) {
+	case SIGTERM:
+	case SIGINT:
+		in_loop = TRUE;
+		quit_timeout_cb (NULL);
+
+	default:
+		if (g_strsignal (signo)) {
+			g_print ("\n");
+			g_print ("Received signal:%d->'%s'",
+				 signo,
+				 g_strsignal (signo));
+		}
+		break;
+	}
+}
+
+static void
+initialize_signal_handler (void)
+{
+#ifndef G_OS_WIN32
+	struct sigaction act;
+	sigset_t	 empty_mask;
+
+	sigemptyset (&empty_mask);
+	act.sa_handler = signal_handler;
+	act.sa_mask    = empty_mask;
+	act.sa_flags   = 0;
+
+	sigaction (SIGTERM, &act, NULL);
+	sigaction (SIGINT,  &act, NULL);
+	sigaction (SIGHUP,  &act, NULL);
+#endif /* G_OS_WIN32 */
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -159,6 +205,8 @@
 
 	g_print ("\n" ABOUT "\n" LICENSE "\n");
 
+	initialize_signal_handler ();
+
 	tracker_memory_setrlimits ();
 
 	g_type_init ();

Modified: trunk/src/tracker-indexer/tracker-main.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-main.c	(original)
+++ trunk/src/tracker-indexer/tracker-main.c	Tue Feb 24 12:23:10 2009
@@ -144,24 +144,16 @@
 }
 
 static void
-signal_handler (gint signo)
+signal_handler (int signo)
 {
 	static gboolean in_loop = FALSE;
 
-	/* die if we get re-entrant signals handler calls */
+	/* Die if we get re-entrant signals handler calls */
 	if (in_loop) {
 		exit (EXIT_FAILURE);
 	}
 
 	switch (signo) {
-	case SIGSEGV:
-		/* we are screwed if we get this so exit immediately! */
-		exit (EXIT_FAILURE);
-
-	case SIGBUS:
-	case SIGILL:
-	case SIGFPE:
-	case SIGABRT:
 	case SIGTERM:
 	case SIGINT:
 		in_loop = TRUE;
@@ -169,7 +161,10 @@
 
 	default:
 		if (g_strsignal (signo)) {
-			g_warning ("Received signal: %s", g_strsignal (signo));
+			g_print ("\n");
+			g_print ("Received signal:%d->'%s'",
+                                 signo,
+                                 g_strsignal (signo));
 		}
 		break;
 	}
@@ -179,7 +174,7 @@
 initialize_signal_handler (void)
 {
 #ifndef G_OS_WIN32
-	struct sigaction act, ign_act;
+	struct sigaction act;
 	sigset_t	 empty_mask;
 
 	sigemptyset (&empty_mask);
@@ -187,21 +182,10 @@
 	act.sa_mask    = empty_mask;
 	act.sa_flags   = 0;
 
-	ign_act.sa_handler = SIG_IGN;
-	ign_act.sa_mask = empty_mask;
-	ign_act.sa_flags = 0;
-
 	sigaction (SIGTERM, &act, NULL);
-	sigaction (SIGILL,  &act, NULL);
-	sigaction (SIGBUS,  &act, NULL);
-	sigaction (SIGFPE,  &act, NULL);
-	sigaction (SIGHUP,  &act, NULL);
-	sigaction (SIGSEGV, &act, NULL);
-	sigaction (SIGABRT, &act, NULL);
-	sigaction (SIGUSR1, &act, NULL);
 	sigaction (SIGINT,  &act, NULL);
-	sigaction (SIGPIPE, &ign_act, NULL);
-#endif
+	sigaction (SIGHUP,  &act, NULL);
+#endif /* G_OS_WIN32 */
 }
 
 static void
@@ -442,7 +426,6 @@
 
 	g_message ("Starting...");
 
-
 	main_loop = g_main_loop_new (NULL, FALSE);
 	g_main_loop_run (main_loop);
 
@@ -450,7 +433,6 @@
 
 	tracker_turtle_shutdown ();
 
-
 	if (quit_timeout_id) {
 		g_source_remove (quit_timeout_id);
 	}

Modified: trunk/src/tracker-utils/tracker-status.c
==============================================================================
--- trunk/src/tracker-utils/tracker-status.c	(original)
+++ trunk/src/tracker-utils/tracker-status.c	Tue Feb 24 12:23:10 2009
@@ -189,7 +189,7 @@
 }
 
 static void
-signal_handler (gint signo)
+signal_handler (int signo)
 {
 	static gboolean in_loop = FALSE;
 
@@ -199,15 +199,6 @@
 	}
 
 	switch (signo) {
-	case SIGSEGV:
-		/* We are screwed if we get this so exit immediately! */
-		exit (EXIT_FAILURE);
-
-	case SIGBUS:
-	case SIGILL:
-	case SIGFPE:
-	case SIGPIPE:
-	case SIGABRT:
 	case SIGTERM:
 	case SIGINT:
 		in_loop = TRUE;
@@ -216,7 +207,7 @@
 	default:
 		if (g_strsignal (signo)) {
 			g_print ("\n");
-			g_print ("Received signal:%d->'%s'\n",
+			g_print ("Received signal:%d->'%s'",
 				 signo,
 				 g_strsignal (signo));
 		}
@@ -228,8 +219,8 @@
 initialize_signal_handler (void)
 {
 #ifndef G_OS_WIN32
-	struct sigaction   act;
-	sigset_t	   empty_mask;
+	struct sigaction act;
+	sigset_t	 empty_mask;
 
 	sigemptyset (&empty_mask);
 	act.sa_handler = signal_handler;
@@ -237,14 +228,8 @@
 	act.sa_flags   = 0;
 
 	sigaction (SIGTERM, &act, NULL);
-	sigaction (SIGILL,  &act, NULL);
-	sigaction (SIGBUS,  &act, NULL);
-	sigaction (SIGFPE,  &act, NULL);
-	sigaction (SIGHUP,  &act, NULL);
-	sigaction (SIGSEGV, &act, NULL);
-	sigaction (SIGABRT, &act, NULL);
-	sigaction (SIGUSR1, &act, NULL);
 	sigaction (SIGINT,  &act, NULL);
+	sigaction (SIGHUP,  &act, NULL);
 #endif /* G_OS_WIN32 */
 }
 

Modified: trunk/src/trackerd/tracker-main.c
==============================================================================
--- trunk/src/trackerd/tracker-main.c	(original)
+++ trunk/src/trackerd/tracker-main.c	Tue Feb 24 12:23:10 2009
@@ -425,7 +425,7 @@
 }
 
 static void
-signal_handler (gint signo)
+signal_handler (int signo)
 {
 	static gboolean in_loop = FALSE;
 
@@ -435,15 +435,6 @@
 	}
 
 	switch (signo) {
-	case SIGSEGV:
-		/* We are screwed if we get this so exit immediately! */
-		exit (EXIT_FAILURE);
-
-	case SIGBUS:
-	case SIGILL:
-	case SIGFPE:
-	case SIGPIPE:
-	case SIGABRT:
 	case SIGTERM:
 	case SIGINT:
 		in_loop = TRUE;
@@ -451,9 +442,10 @@
 
 	default:
 		if (g_strsignal (signo)) {
-			g_message ("Received signal:%d->'%s'",
-				   signo,
-				   g_strsignal (signo));
+			g_print ("\n");
+			g_print ("Received signal:%d->'%s'",
+				 signo,
+				 g_strsignal (signo));
 		}
 		break;
 	}
@@ -463,8 +455,8 @@
 initialize_signal_handler (void)
 {
 #ifndef G_OS_WIN32
-	struct sigaction   act;
-	sigset_t	   empty_mask;
+	struct sigaction act;
+	sigset_t	 empty_mask;
 
 	sigemptyset (&empty_mask);
 	act.sa_handler = signal_handler;
@@ -472,14 +464,8 @@
 	act.sa_flags   = 0;
 
 	sigaction (SIGTERM, &act, NULL);
-	sigaction (SIGILL,  &act, NULL);
-	sigaction (SIGBUS,  &act, NULL);
-	sigaction (SIGFPE,  &act, NULL);
-	sigaction (SIGHUP,  &act, NULL);
-	sigaction (SIGSEGV, &act, NULL);
-	sigaction (SIGABRT, &act, NULL);
-	sigaction (SIGUSR1, &act, NULL);
 	sigaction (SIGINT,  &act, NULL);
+	sigaction (SIGHUP,  &act, NULL);
 #endif /* G_OS_WIN32 */
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]