From 0844a5a27bc7f08fd56ae0962296782cd539ced3 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 28 Nov 2019 15:56:57 +0100 Subject: [PATCH] log, minor bug in reverse log reader, when reading clog files, the beginning of the file isn't detected. found while working on https://github.com/opnsense/core/issues/3831 --- src/opnsense/site-python/log_helper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opnsense/site-python/log_helper.py b/src/opnsense/site-python/log_helper.py index 9c0a91bca..f047b4ee6 100644 --- a/src/opnsense/site-python/log_helper.py +++ b/src/opnsense/site-python/log_helper.py @@ -61,6 +61,8 @@ def reverse_log_reader(filename, block_size=81920, start_pos=None): data = input_stream.read(block_size) + data # split stream using begin of line (bol) and end of line (eol) bol = data.rfind('\n') + if bol == -1: + bol = data.rfind('\u0000') eol = len(data) while bol > -1: