crash reporter: avoid repeated warning collection

The warning collector daemon parses the entire syslog every time it
starts (almost exclusively at boot).  This change makes the collector
start reading at the end of /var/log/messages (where it waits for further
input) rather than the beginning.  The collector will miss any warnings
that may have occurred between the last warning reported, and the daemon
restart.

BUG=chromium:343954
TEST=none yet
BRANCH=none

Change-Id: I5e9b141561365b9a1d328ed6283c27e8b3369a6f
Reviewed-on: https://chromium-review.googlesource.com/186605
Reviewed-by: Grant Grundler <grundler@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
This commit is contained in:
Luigi Semenzato 2014-02-14 10:41:18 -08:00 committed by chrome-internal-fetch
parent b20c9ef8e9
commit 325a2e313d
1 changed files with 7 additions and 0 deletions

View File

@ -160,6 +160,13 @@ static void WarnOpenInput(const char *path) {
if (yyin_fd < 0)
Die("could not open %s: %s\n", path, strerror(errno));
if (!fifo) {
/* Go directly to the end of the file. We don't want to parse the same
* warnings multiple times on reboot/restart. We might miss some
* warnings, but so be it---it's too hard to keep track reliably of the
* last parsed position in the syslog.
*/
if (lseek(yyin_fd, 0, SEEK_END) < 0)
Die("could not lseek %s: %s\n", path, strerror(errno));
/* Set up notification of file growth and rename. */
i_fd = inotify_init();
if (i_fd < 0)