Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/plugins/reporter-bugzilla.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index ee0da0f..b1d7fa1 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -44,6 +44,27 @@ static void set_settings(struct bugzilla_struct *b, map_string_h
*settings)
b->b_release = environ ? environ : get_map_string_item_or_NULL(settings,
"OSRelease");
}
+/* caller is responsible to free returned value */
+static char *get_duphash(problem_data_t *problem_data)
+{
+ char *remote_result;
+ remote_result = xstrdup(get_problem_item_content_or_NULL(problem_data,
FILENAME_REMOTE_RESULT));
+ char *duphash = xstrdup(get_problem_item_content_or_NULL(problem_data,
FILENAME_DUPHASH));
+ if (!remote_result || !*remote_result)
+ return duphash;
+
+ char *line_tok = strtok(remote_result, "\n");
+ while (line_tok)
+ {
+ if (!prefixcmp(line_tok, "DUPLICATE "))
+ return line_tok + strlen("DUPLICATE ");
+
+ line_tok = strtok(NULL, "\n");
+ }
+
+ return duphash;
+}
+
int main(int argc, char **argv)
{
abrt_init(argv);
@@ -262,7 +283,8 @@ int main(int argc, char **argv)
xfunc_die(); /* create_problem_data_for_reporting already emitted error msg */
const char *component = get_problem_item_content_or_die(problem_data,
FILENAME_COMPONENT);
- const char *duphash = get_problem_item_content_or_NULL(problem_data,
FILENAME_DUPHASH);
+ const char *duphash = get_duphash(problem_data);
+
//COMPAT, remove after 2.1 release
if (!duphash) duphash = get_problem_item_content_or_die(problem_data,
"global_uuid");
if (!rhbz.b_release || !*rhbz.b_release) /* if not overridden or empty... */
--
1.7.9.rc2
Show replies by date