[evolution] killev.c: Don't kill D-Bus services.



commit 05724f4273c8b76ce3b2bd98def409de7e6d107e
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jul 2 11:18:01 2012 -0400

    killev.c: Don't kill D-Bus services.
    
    Evolution is no longer a privileged D-Bus client.  Only terminate
    Evolution, not the D-Bus services that other clients may be using.

 shell/killev.c |   61 +++++++++++++++++++++++---------------------------------
 1 files changed, 25 insertions(+), 36 deletions(-)
---
diff --git a/shell/killev.c b/shell/killev.c
index 9c99130..11afdc4 100644
--- a/shell/killev.c
+++ b/shell/killev.c
@@ -94,18 +94,6 @@ exit:
 	return success;
 }
 
-static void
-kill_factories (void)
-{
-	#ifdef KILL_PROCESS_CMD
-
-	system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null");
-	system (KILL_PROCESS_CMD " -QUIT e-calendar-factory 2> /dev/null");
-	system (KILL_PROCESS_CMD " -QUIT e-addressbook-factory 2> /dev/null");
-
-	#endif
-}
-
 gint
 main (gint argc,
       gchar **argv)
@@ -114,6 +102,7 @@ main (gint argc,
 	GFileMonitor *monitor;
 	const gchar *user_config_dir;
 	gchar *filename;
+	gint retval = EXIT_SUCCESS;
 	GError *error = NULL;
 
 	bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
@@ -129,27 +118,22 @@ main (gint argc,
 
 	if (!get_evolution_pid (pid_file)) {
 		g_printerr ("Could not find Evolution's process ID\n");
-		kill_factories ();
-		exit (EXIT_FAILURE);
+		retval = EXIT_FAILURE;
+		goto kill;
 	}
 
-	if (g_getenv ("DISPLAY") == NULL) {
-		#ifdef KILL_PROCESS_CMD
-
-		system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null");
-
-		#endif
-	} else {
-		/* Play it safe here and bail if something goes wrong.  We don't
-		 * want to just skip to the killing if we can't ask Evolution to
-		 * terminate gracefully.  Despite our name we actually want to
-		 * -avoid- killing Evolution if at all possible. */
-		if (!g_spawn_command_line_async ("evolution --quit", &error)) {
-			g_printerr ("%s", error->message);
-			g_error_free (error);
-			kill_factories ();
-			exit (EXIT_FAILURE);
-		}
+	if (g_getenv ("DISPLAY") == NULL)
+		goto kill;
+
+	/* Play it safe here and bail if something goes wrong.  We don't
+	 * want to just skip to the killing if we can't ask Evolution to
+	 * terminate gracefully.  Despite our name we actually want to
+	 * -avoid- killing Evolution if at all possible. */
+	if (!g_spawn_command_line_async ("evolution --quit", &error)) {
+		g_printerr ("%s\n", error->message);
+		g_error_free (error);
+		retval = EXIT_FAILURE;
+		goto kill;
 	}
 
 	/* Now we set up a monitor on Evolution's .running file.
@@ -157,10 +141,10 @@ main (gint argc,
 	 * file just before terminating and we'll be notified. */
 	monitor = g_file_monitor_file (pid_file, 0, NULL, &error);
 	if (error != NULL) {
-		g_printerr ("%s", error->message);
+		g_printerr ("%s\n", error->message);
 		g_error_free (error);
-		kill_factories ();
-		exit (EXIT_FAILURE);
+		retval = EXIT_FAILURE;
+		goto kill;
 	}
 
 	g_signal_connect (
@@ -179,7 +163,12 @@ main (gint argc,
 
 	g_object_unref (monitor);
 
-	kill_factories ();
+kill:
+#ifdef KILL_PROCESS_CMD
+	system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null");
+#else
+	g_printerr ("No \"kill\" command available.\n");
+#endif
 
-	return EXIT_SUCCESS;
+	return retval;
 }



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