[rrd-developers] [PATCH] journal_replay: detect eof failure in fgets() and break out.
kevin brintnall
kbrint at rufus.net
Mon Sep 29 21:05:53 CEST 2008
This bug caused the last line in each journal file to be processed a
second time. Since it had been modified due to tokenizing, it failed
syntax check. The daemon would always record one failed line at
end-of-journal as a result. No data loss incurred by this bug.
---
src/rrd_daemon.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index abcb788..ead969b 100644
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
@@ -1508,7 +1508,8 @@ static int journal_replay (const char *file) /* {{{ */
size_t entry_len;
++line;
- fgets(entry, sizeof(entry), fh);
+ if (fgets(entry, sizeof(entry), fh) == NULL)
+ break;
entry_len = strlen(entry);
/* check \n termination in case journal writing crashed mid-line */
--
1.6.0.2
More information about the rrd-developers
mailing list