fix peeking

This commit is contained in:
Florian Stinglmayr 2025-05-02 13:12:02 +02:00
parent 6dbff67bee
commit ca2b771d27

View File

@ -362,9 +362,9 @@ static EDErrorCode ed_journal_file_read_last_(EDJournalFile *self)
while (TRUE) { while (TRUE) {
/* arbitrary */ /* arbitrary */
pos = end - 100; pos = (pos - 100);
if (pos <= 0) { if (pos <= 0) {
break; pos = 0;
} }
if (!g_seekable_seek(G_SEEKABLE(stream), pos, G_SEEK_SET, if (!g_seekable_seek(G_SEEKABLE(stream), pos, G_SEEK_SET,
@ -398,7 +398,11 @@ static EDErrorCode ed_journal_file_read_last_(EDJournalFile *self)
} while (TRUE); } while (TRUE);
if (last == NULL) { if (last == NULL) {
if (pos <= 0) {
goto done; goto done;
} else {
continue;
}
} }
entry = ed_journal_entry_new_parse(last, NULL); entry = ed_journal_entry_new_parse(last, NULL);