From 62919cfbd5ed0d3a19ca96ccb6508db1bae2f8d8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 8 Apr 2011 17:43:17 +0200 Subject: abrt-action-print: add -r option which records reported_to Signed-off-by: Denys Vlasenko --- src/daemon/abrt_event.conf | 2 +- src/lib/event_xml_parser.c | 2 +- src/plugins/abrt-action-print.c | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/daemon/abrt_event.conf b/src/daemon/abrt_event.conf index 35f6fb0a..aa578200 100644 --- a/src/daemon/abrt_event.conf +++ b/src/daemon/abrt_event.conf @@ -73,4 +73,4 @@ EVENT=post-create analyzer=Python abrt-action-analyze-python EVENT=report_Bugzilla analyzer=Python abrt-action-bugzilla -c /etc/abrt/plugins/Bugzilla.conf -EVENT=report_Logger abrt-action-print -o "${Log_File:-/tmp/abrt.log}" -a "${Append:-no}" +EVENT=report_Logger abrt-action-print -o "${Log_File:-/tmp/abrt.log}" -a "${Append:-no}" -r diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c index 8bb89027..3e7faaf3 100644 --- a/src/lib/event_xml_parser.c +++ b/src/lib/event_xml_parser.c @@ -308,7 +308,7 @@ static void passthrough(GMarkupParseContext *context, gpointer user_data, GError **error) { - VERB2 log("passthrough"); + VERB3 log("passthrough"); } // Called on error, including one set by other diff --git a/src/plugins/abrt-action-print.c b/src/plugins/abrt-action-print.c index be2179a5..4ca0be0b 100644 --- a/src/plugins/abrt-action-print.c +++ b/src/plugins/abrt-action-print.c @@ -45,6 +45,7 @@ int main(int argc, char **argv) OPT_d = 1 << 1, OPT_o = 1 << 2, OPT_a = 1 << 3, + OPT_r = 1 << 4, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { @@ -52,9 +53,10 @@ int main(int argc, char **argv) OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")), OPT_STRING('o', NULL, &output_file , "FILE" , _("Output file")), OPT_STRING('a', NULL, &append , "yes/no", _("Append to, or overwrite FILE")), + OPT_BOOL( 'r', NULL, NULL , _("Create reported_to in DIR")), OPT_END() }; - /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); + unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); @@ -84,6 +86,17 @@ int main(int argc, char **argv) if (output_file) { + if (opts & OPT_r) + { + dd = dd_opendir(dump_dir_name, /*flags:*/ 0); + if (dd) + { + char *msg = xasprintf("file: %s", output_file); + add_reported_to(dd, msg); + free(msg); + dd_close(dd); + } + } const char *format = (open_mode[0] == 'a' ? _("The report was appended to %s") : _("The report was stored to %s")); log(format, output_file); } -- cgit