ryantimwilson / rpms / systemd

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