daandemeyer / rpms / systemd

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