Blame SOURCES/0350-journalctl-make-sure-journalctl-f-t-unmatched-blocks.patch

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