From aa26ace366d93b0b4ae7852bfc0b8bafa7819e49 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 21 Oct 2010 15:04:13 +0200 Subject: abrt-action-rhtsupport: fix error handling Signed-off-by: Denys Vlasenko --- src/daemon/abrt-action-rhtsupport.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/daemon/abrt-action-rhtsupport.cpp') diff --git a/src/daemon/abrt-action-rhtsupport.cpp b/src/daemon/abrt-action-rhtsupport.cpp index d3918761..c9f6531b 100644 --- a/src/daemon/abrt-action-rhtsupport.cpp +++ b/src/daemon/abrt-action-rhtsupport.cpp @@ -201,8 +201,35 @@ static void report_to_rhtsupport( package, tempfile ); - VERB3 log("post result:'%s'", result); - printf("STATUS:%s", result); + /* Temporary hackish detection of errors. Ideally, + * send_report_to_new_case needs to have better error reporting. + */ + if (strncasecmp(result, "error", 5) == 0) + { + /* + * result can contain "...server says: 'multi-line text'" + * Replace all '\n' with spaces: + * we want this message to be, logically, one log entry. + * IOW: one line, not many lines. + */ + char *src, *dst; + dst = src = result; + while (1) + { + unsigned char c = *src++; + if (c == '\n') + c = ' '; + dst++ = c; + if (c == '\0') + break; + } + /* Use sanitized string as error message */ + CABRTException e(EXCEP_PLUGIN, "%s", result); + free(result); + throw e; + } + /* No error */ + printf("STATUS:%s\n", result); free(result); } -- cgit