File 0001-kerneloops-add-debug-dbus-to-daemon-options.patch of Package kerneloops

From 1c2db9efe22ecc1cad5346eda88e7526e34d1bc9 Mon Sep 17 00:00:00 2001
From: Brandon Philips <brandon@ifup.org>
Date: Thu, 25 Sep 2008 20:35:01 -0700
Subject: [PATCH] kerneloops: add --debug-dbus to daemon options

--debug-dbus will run the kerneloops daemon in debug mode with the dbus client
interaction.  This is a handy way to test the client.

Signed-off-by: Brandon Philips <bphilips@suse.de>
---
 kerneloops.c |    6 +++++-
 submit.c     |    8 ++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/kerneloops.c b/kerneloops.c
index 0efbd40..de1ba09 100644
--- a/kerneloops.c
+++ b/kerneloops.c
@@ -151,6 +151,9 @@ int main(int argc, char**argv)
 		testmode = 1;
 		opted_in = 2;
 	}
+	/* Test DBUS and notification client, exit on submit_queue */
+	if (argc > 1 && strstr(argv[1], "--debug-dbus"))
+		opted_in = 1;
 
 	if (!opted_in && !testmode) {
 		fprintf(stderr, " [Inactive by user preference]");
@@ -203,7 +206,8 @@ int main(int argc, char**argv)
 		}
 	}
 
-	if (testmode) {
+	/* Disconnect dbus if not --debug-dbus */
+	if (testmode && opted_in == 2) {
 		g_main_loop_unref(loop);
 		dbus_bus_remove_match(bus, "type='signal',interface='org.kerneloops.submit.ping'", &error);
 		dbus_bus_remove_match(bus, "type='signal',interface='org.kerneloops.submit.permission'", &error);
diff --git a/submit.c b/submit.c
index 6f1d8c0..a7d4b42 100644
--- a/submit.c
+++ b/submit.c
@@ -212,6 +212,10 @@ void submit_queue(void)
 
 	if (testmode) {
 		print_queue();
+
+		if (opted_in == 1)
+			exit(EXIT_SUCCESS);
+
 		return;
 	}
 
@@ -284,6 +288,10 @@ void clear_queue(void)
 		free(oops);
 		oops = next;
 	}
+
+	if (testmode)
+		exit(EXIT_SUCCESS);
+
 	write_logfile(0);
 }
 
-- 
1.5.6

openSUSE Build Service is sponsored by