dcavalca / rpms / systemd

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