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 <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/16501
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Bryan Freed <bfreed@chromium.org>
This commit is contained in:
Kees Cook 2012-02-22 17:15:15 -08:00 committed by Gerrit
parent d3ac79663f
commit 5825d5a642

View file

@ -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;