#include <fcntl.h>
#include "sd-journal.h"
+#include "macro.h"
#include "journal-file.h"
#include "journal-internal.h"
r = journal_file_open(fn, O_CREAT|O_RDWR, 0644, false, false, NULL, NULL, NULL, &new_journal);
assert_se(r >= 0);
- unlink(fn);
-
r = sd_journal_open(&j, 0);
assert_se(r >= 0);
JournalFile *f;
f = j->current_file;
- assert(f && f->current_offset > 0);
+ assert_se(f && f->current_offset > 0);
r = journal_file_move_to_object(f, OBJECT_ENTRY, f->current_offset, &o);
- assert(r >= 0);
+ assert_se(r >= 0);
r = journal_file_copy_entry(f, new_journal, o, f->current_offset, NULL, NULL, NULL);
- assert(r >= 0);
+ assert_se(r >= 0);
n++;
if (n > 10000)
journal_file_close(new_journal);
+ unlink(fn);
assert_se(rmdir(dn) == 0);
return 0;