mirror of
https://github.com/pi-hole/web.git
synced 2026-04-25 11:19:59 +01:00
Fix file pointer position if file was truncated
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
@@ -43,6 +43,12 @@ if (!$file) {
|
||||
if (isset($_GET['offset'])) {
|
||||
$offset = intval($_GET['offset']);
|
||||
if ($offset > 0) {
|
||||
// If offset is grater then current file end it means the file was truncated (log rotation)
|
||||
fseek($file, 0, SEEK_END);
|
||||
if ($offset > ftell($file)) {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
// Seeks on the file pointer where we want to continue reading is known
|
||||
fseek($file, $offset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user