aboutsummaryrefslogtreecommitdiffstats
path: root/journal-notify.c
diff options
context:
space:
mode:
Diffstat (limited to 'journal-notify.c')
-rw-r--r--journal-notify.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/journal-notify.c b/journal-notify.c
index 98649ba..1a737bd 100644
--- a/journal-notify.c
+++ b/journal-notify.c
@@ -68,6 +68,7 @@ int main(int argc, char **argv) {
int regex_flags = REG_NOSUB;
sd_journal * journal;
+ uint8_t old_entry = 1;
const void * data;
size_t length;
@@ -195,6 +196,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Failed to iterate to next entry: %s\n", strerror(-rc));
goto out40;
} else if (rc == 0) {
+ old_entry = 0;
if (verbose > 2)
printf("Waiting...\n");
if ((rc = sd_journal_wait(journal, (uint64_t) -1)) < 0) {
@@ -204,6 +206,14 @@ int main(int argc, char **argv) {
continue;
}
+ /* Looks like there is a but in libsystemd journal handling
+ * that jumps to wrong entries. Just skip old entries until we
+ * have a recent ones. */
+ if (old_entry > 0) {
+ fprintf(stderr, "This is an old entry, ignoring.\n");
+ continue;
+ }
+
/* get MESSAGE field */
if ((rc = sd_journal_get_data(journal, "MESSAGE", &data, &length)) < 0) {
fprintf(stderr, "Failed to read message field: %s\n", strerror(-rc));