Merge pull request #21529 from keszybz/test-journal-flush-no-crash

Fix crash in test-journal-flush in CI
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-11-26 12:28:44 +01:00
committed by GitHub
+10 -4
View File
@@ -29,8 +29,11 @@ int main(int argc, char *argv[]) {
r = journal_file_open(-1, fn, O_CREAT|O_RDWR, 0644, false, 0, false, NULL, NULL, NULL, NULL, &new_journal);
assert_se(r >= 0);
r = sd_journal_open(&j, 0);
assert_se(r >= 0);
if (argc > 1)
r = sd_journal_open_files(&j, (const char **) strv_skip(argv, 1), 0);
else
r = sd_journal_open(&j, 0);
assert_se(r == 0);
sd_journal_set_data_threshold(j, 0);
@@ -48,8 +51,11 @@ int main(int argc, char *argv[]) {
r = journal_file_copy_entry(f, new_journal, o, f->current_offset);
if (r < 0)
log_error_errno(r, "journal_file_copy_entry failed: %m");
assert_se(r >= 0);
log_warning_errno(r, "journal_file_copy_entry failed: %m");
assert_se(r >= 0 ||
IN_SET(r, -EBADMSG, /* corrupted file */
-EPROTONOSUPPORT, /* unsupported compression */
-EIO)); /* file rotated */
if (++n >= 10000)
break;