diff options
-rw-r--r-- | lib/Plugins/Bugzilla.cpp | 63 | ||||
-rw-r--r-- | lib/Plugins/CCpp.cpp | 2 | ||||
-rw-r--r-- | lib/Utils/DebugDump.cpp | 3 |
3 files changed, 34 insertions, 34 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp index 23033166..78271131 100644 --- a/lib/Plugins/Bugzilla.cpp +++ b/lib/Plugins/Bugzilla.cpp @@ -1,14 +1,11 @@ #include <xmlrpc-c/base.h> #include <xmlrpc-c/client.h> - #include "abrtlib.h" #include "Bugzilla.h" #include "CrashTypes.h" #include "DebugDump.h" #include "ABRTException.h" #include "CommLayerInner.h" - - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -43,11 +40,11 @@ static void get_product_and_version(const std::string& pRelease, std::string& pVersion); -static void throw_if_fault_occurred(xmlrpc_env* e) +static void throw_if_xml_fault_occurred() { - if (e->fault_occurred) + if (env.fault_occurred) { - std::string errmsg = ssprintf("XML-RPC Fault: %s(%d)", e->fault_string, e->fault_code); + std::string errmsg = ssprintf("XML-RPC Fault: %s(%d)", env.fault_string, env.fault_code); error_msg("%s", errmsg.c_str()); // show error in daemon log throw CABRTException(EXCEP_PLUGIN, errmsg); } @@ -73,10 +70,10 @@ static void new_xmlrpc_client(const char* url, bool no_ssl_verify) xmlrpc_client_create(&env, XMLRPC_CLIENT_NO_FLAGS, PACKAGE_NAME, VERSION, &clientParms, XMLRPC_CPSIZE(transportparm_size), &client); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); server_info = xmlrpc_server_info_new(&env, url); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); } static void destroy_xmlrpc_client() @@ -102,10 +99,10 @@ static void login(const char* login, const char* passwd) xmlrpc_value* param = NULL; param = xmlrpc_build_value(&env, "({s:s,s:s})", "login", login, "password", passwd); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_client_call2(&env, client, server_info, "User.login", param, &result); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_DECREF(result); xmlrpc_DECREF(param); @@ -117,10 +114,10 @@ static void logout() xmlrpc_value* param = NULL; param = xmlrpc_build_value(&env, "(s)", ""); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_client_call2(&env, client, server_info, "User.logout", param, &result); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_DECREF(result); xmlrpc_DECREF(param); @@ -136,19 +133,19 @@ static bool check_cc_and_reporter(const uint32_t bug_id, const char* login) const char* bug = to_string(bug_id).c_str(); param = xmlrpc_build_value(&env, "(s)", bug); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_client_call2(&env, client, server_info, "bugzilla.getBug", param, &result); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_struct_find_value(&env, result, "reporter", &reporter_member); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); if (reporter_member) { const char* reporter = NULL; xmlrpc_read_string(&env, reporter_member, &reporter); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); if (strcmp(reporter, login) == 0 ) { @@ -161,7 +158,7 @@ static bool check_cc_and_reporter(const uint32_t bug_id, const char* login) } xmlrpc_struct_find_value(&env, result, "cc", &cc_member); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); if (cc_member) { @@ -171,11 +168,11 @@ static bool check_cc_and_reporter(const uint32_t bug_id, const char* login) for (uint32_t i = 0; i < array_size; i++) { xmlrpc_array_read_item(&env, cc_member, i, &item); // Correct - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); const char* cc = NULL; xmlrpc_read_string(&env, item, &cc); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); if (strcmp(cc, login) == 0) { @@ -202,10 +199,10 @@ static void add_plus_one_cc(const uint32_t bug_id, const char* login) xmlrpc_value* result = NULL; param = xmlrpc_build_value(&env, "({s:i,s:{s:(s)}})", "ids", bug_id, "updates", "add_cc", login); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_client_call2(&env, client, server_info, "Bug.update", param, &result); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_DECREF(result); xmlrpc_DECREF(param); @@ -223,29 +220,29 @@ static int32_t check_uuid_in_bugzilla(const char* component, const char* UUID) snprintf(query, 1023, "ALL component:\"%s\" statuswhiteboard:\"%s\"", component, UUID); param = xmlrpc_build_value(&env, "({s:s})", "quicksearch", query); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_client_call2(&env, client, server_info, "Bug.search", param, &result); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_struct_find_value(&env, result, "bugs", &bugs_member); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); if (bugs_member) { // when array size is equal 0 that means no bug reported uint32_t array_size = xmlrpc_array_size(&env, bugs_member); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); if( array_size == 0 ) return -1; xmlrpc_value* item = NULL; xmlrpc_array_read_item(&env, bugs_member, 0, &item); // Correct - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_value* bug = NULL; xmlrpc_struct_find_value(&env, item,"bug_id", &bug); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); if (bug) { xmlrpc_read_int(&env, bug, &bug_id); @@ -379,21 +376,21 @@ static uint32_t new_bug(const map_crash_report_t& pCrashReport) "status_whiteboard", status_whiteboard.c_str(), "platform", arch.c_str() ); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_value* result; xmlrpc_client_call2(&env, client, server_info, "Bug.create", param, &result); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_value* id; xmlrpc_struct_find_value(&env, result, "id", &id); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_int bug_id = -1; if (id) { xmlrpc_read_int(&env, id, &bug_id); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); log("New bug id: %i", bug_id); update_client(_("New bug id: ") + to_string(bug_id)); } @@ -424,10 +421,10 @@ static void add_attachments(const std::string& pBugId, const map_crash_report_t& "data", encoded64 ); free(encoded64); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_client_call2(&env, client, server_info, "bugzilla.addAttachment", param, &result); - throw_if_fault_occurred(&env); + throw_if_xml_fault_occurred(); xmlrpc_DECREF(result); xmlrpc_DECREF(param); } diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 89e9c5cc..4eacdd20 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -828,7 +828,7 @@ void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir, int force) { dd.SaveText(FILENAME_MEMORYMAP, "memory map of the crashed C/C++ application, not implemented yet"); } - std::string rating = ssprintf("%d\n", rate_backtrace(backtrace)); + std::string rating = ssprintf("%d", rate_backtrace(backtrace)); dd.SaveText(FILENAME_RATING, rating); dd.Close(); } diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 51c25da4..ecd6d05b 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -362,6 +362,9 @@ void CDebugDump::SaveKernelArchitectureRelease() } std::string release; LoadTextFile("/etc/redhat-release", release); + const char *release_ptr = release.c_str(); + unsigned len_1st_str = strchrnul(release_ptr, '\n') - release_ptr; + release.erase(len_1st_str); /* usually simply removes trailing '\n' */ SaveText(FILENAME_RELEASE, release); } |