summaryrefslogtreecommitdiffstats
path: root/lib/Plugins/KerneloopsScanner.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-29 00:37:10 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-29 00:37:10 +0100
commitf369ec1fa4e2886ce01aeea51044d15f0407fed3 (patch)
tree5445e7adae55895bcf839cbad3a10c510692053c /lib/Plugins/KerneloopsScanner.cpp
parent7a2a2fa7e8d613c69d0fda6c220d97936f56c4fd (diff)
downloadabrt-f369ec1fa4e2886ce01aeea51044d15f0407fed3.tar.gz
abrt-f369ec1fa4e2886ce01aeea51044d15f0407fed3.tar.xz
abrt-f369ec1fa4e2886ce01aeea51044d15f0407fed3.zip
Kerneloops: remove two classes, vector_string_t works as good
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Plugins/KerneloopsScanner.cpp')
-rw-r--r--lib/Plugins/KerneloopsScanner.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp
index 317aeab..14eb72a 100644
--- a/lib/Plugins/KerneloopsScanner.cpp
+++ b/lib/Plugins/KerneloopsScanner.cpp
@@ -78,24 +78,29 @@ void CKerneloopsScanner::SaveOopsToDebugDump()
{
update_client(_("Creating kernel oops crash reports..."));
+ int countdown = 16; /* do not report hundreds of oopses */
time_t t = time(NULL);
- std::list<COops> oopsList = m_pSysLog.GetOopsList();
- m_pSysLog.ClearOopsList();
+ vector_string_t oopsList = m_pOopsList;
+ m_pOopsList.clear();
- while (!oopsList.empty()) {
+ while (!oopsList.empty() && --countdown != 0) {
char path[sizeof(DEBUG_DUMPS_DIR"/kerneloops-%lu-%lu") + 2 * sizeof(long)*3];
sprintf(path, DEBUG_DUMPS_DIR"/kerneloops-%lu-%lu",
(long)t, (long)oopsList.size());
- COops oops = oopsList.back();
+
+ std::string oops = oopsList.back();
+ const char *first_line = oops.c_str();
+ char *second_line = (char*)strchr(first_line, '\n'); /* never NULL */
+ *second_line++ = '\0';
try
{
CDebugDump debugDump;
debugDump.Create(path, 0);
debugDump.SaveText(FILENAME_ANALYZER, "Kerneloops");
debugDump.SaveText(FILENAME_EXECUTABLE, "kernel");
- debugDump.SaveText(FILENAME_KERNEL, oops.m_sVersion);
+ debugDump.SaveText(FILENAME_KERNEL, first_line);
debugDump.SaveText(FILENAME_PACKAGE, "not_applicable");
- debugDump.SaveText(FILENAME_KERNELOOPS, oops.m_sData);
+ debugDump.SaveText(FILENAME_KERNELOOPS, second_line);
}
catch (CABRTException& e)
{
@@ -116,7 +121,8 @@ int CKerneloopsScanner::ScanDmesg()
buffer = (char*)xzalloc(pagesz + 1);
syscall(__NR_syslog, 3, buffer, pagesz);
- cnt_FoundOopses = m_pSysLog.ExtractOops(buffer, strlen(buffer));
+ m_pOopsList.clear();
+ cnt_FoundOopses = extract_oopses(m_pOopsList, buffer, strlen(buffer));
free(buffer);
return cnt_FoundOopses;
@@ -160,8 +166,10 @@ int CKerneloopsScanner::ScanSysLogFile(const char *filename)
close(fd);
cnt_FoundOopses = 0;
- if (sz > 0)
- cnt_FoundOopses = m_pSysLog.ExtractOops(buffer, sz);
+ if (sz > 0) {
+ m_pOopsList.clear();
+ cnt_FoundOopses = extract_oopses(m_pOopsList, buffer, sz);
+ }
free(buffer);
return cnt_FoundOopses;