From 5825d5a64241df397e741acb68d3ff81ce8d40ca Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Wed, 22 Feb 2012 17:15:15 -0800 Subject: [PATCH] Remove collected crash report from pstore Make sure that once collected, a crash report is removed from the pstore filesystem so that the memory is cleared to avoid endless crash duplicates. BUG=chromium-os:26496 TEST=lumpy build & boot, triggered crashes ("echo bug > /proc/breakme") are saved to /var/spool/crash and removed from pstore. STATUS=Fixed Change-Id: Ic224f5880cdc34d1f75470ac71f27fcad146ff4b Signed-off-by: Kees Cook Reviewed-on: https://gerrit.chromium.org/gerrit/16501 Reviewed-by: Olof Johansson Reviewed-by: Bryan Freed --- crash_reporter/kernel_collector.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crash_reporter/kernel_collector.cc b/crash_reporter/kernel_collector.cc index c600cec0c..6f2855ae1 100644 --- a/crash_reporter/kernel_collector.cc +++ b/crash_reporter/kernel_collector.cc @@ -80,8 +80,9 @@ bool KernelCollector::ReadRecordToString(std::string *contents, } if (record_re.FullMatch(record, &captured)){ - // Found a match, append it to the content. + // Found a match, append it to the content, and remove from pstore. contents->append(captured); + file_util::Delete(ramoops_record, false); *record_found = true; } else { *record_found = false;