journalctl.c revision 87d2c1ff6a7375f03476767e6f59454bcc5cd04b
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <fcntl.h>
#include <errno.h>
#include <stddef.h>
#include "journal-private.h"
int r;
JournalFile *f;
log_open();
if (r == -ENOENT)
if (r < 0) {
return EXIT_FAILURE;
}
for (;;) {
uint64_t n, i;
r = journal_file_next_entry(f, o, &o, &offset);
if (r < 0) {
goto finish;
}
if (r == 0)
break;
n = journal_file_entry_n_items(o);
for (i = 0; i < n; i++) {
uint64_t p, l;
r = journal_file_move_to_object(f, p, &o);
if (r < 0) {
goto finish;
}
log_error("Invalid file");
goto finish;
}
r = journal_file_move_to_object(f, offset, &o);
if (r < 0) {
goto finish;
}
}
}
return 0;
}