e40f4d
From c025384103a9852f852d075337d1e2066253889f Mon Sep 17 00:00:00 2001
e40f4d
From: Stef Walter <stefw@redhat.com>
e40f4d
Date: Fri, 14 Aug 2015 16:38:41 +0200
e40f4d
Subject: [PATCH 2/4] journalctl: make sure 'journalctl -f -t unmatched' blocks
e40f4d
e40f4d
Previously the following command:
e40f4d
e40f4d
$ journalctl -f -t unmatchedtag12345
e40f4d
e40f4d
... would block when called with criteria that did not match any
e40f4d
journal lines. Once log lines appeared that matched the criteria
e40f4d
they were displayed.
e40f4d
e40f4d
Commit 02ab86c732576a71179ce12e97d44c289833236d broke this
e40f4d
behavior and the journal was not followed, but the command
e40f4d
exits with '-- No entries --' displayed.
e40f4d
e40f4d
This commit fixes the issue.
e40f4d
e40f4d
More information downstream:
e40f4d
e40f4d
https://bugzilla.redhat.com/show_bug.cgi?id=1253649
e40f4d
---
e40f4d
 src/journal/journalctl.c | 8 ++++++--
e40f4d
 1 file changed, 6 insertions(+), 2 deletions(-)
e40f4d
e40f4d
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
e40f4d
index 073cc77..5c058dd 100644
e40f4d
--- a/src/journal/journalctl.c
e40f4d
+++ b/src/journal/journalctl.c
e40f4d
@@ -2067,8 +2067,12 @@ int main(int argc, char *argv[]) {
e40f4d
                 goto finish;
e40f4d
         }
e40f4d
         if (r == 0) {
e40f4d
-                printf("-- No entries --\n");
e40f4d
-                goto finish;
e40f4d
+                if (arg_follow)
e40f4d
+                        need_seek = true;
e40f4d
+                else {
e40f4d
+                        printf("-- No entries --\n");
e40f4d
+                        goto finish;
e40f4d
+                }
e40f4d
         }
e40f4d
 
e40f4d
         if (!arg_follow)
e40f4d
-- 
e40f4d
2.5.0
e40f4d