richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
b11b5f
From b0574acc0bddceb0af47f6cce327a87041ab4b52 Mon Sep 17 00:00:00 2001
b11b5f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
b11b5f
Date: Sun, 11 Nov 2018 12:33:06 +0100
b11b5f
Subject: [PATCH] journalctl: do not treat EINTR as an error when waiting for
b11b5f
 events
b11b5f
b11b5f
Fixup for 2a1e0f2228bbdfbc18635e959f47df7da50b62fe. Fixes #10724.
b11b5f
b11b5f
Reproducer: start 'journalctl -f' in a terminal window, change window size.
b11b5f
(cherry picked from commit 8e143a123276a9636987b08f555603927ca9e186)
b11b5f
b11b5f
Resolves: #2161683
b11b5f
---
b11b5f
 src/journal/journalctl.c | 7 ++++++-
b11b5f
 1 file changed, 6 insertions(+), 1 deletion(-)
b11b5f
b11b5f
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
b11b5f
index fa83dce562..228cfe7e49 100644
b11b5f
--- a/src/journal/journalctl.c
b11b5f
+++ b/src/journal/journalctl.c
b11b5f
@@ -2084,8 +2084,13 @@ static int wait_for_change(sd_journal *j, int poll_fd) {
b11b5f
         if (r < 0)
b11b5f
                 return log_error_errno(r, "Failed to determine journal waiting time: %m");
b11b5f
 
b11b5f
-        if (ppoll(pollfds, ELEMENTSOF(pollfds), timeout == USEC_INFINITY ? NULL : timespec_store(&ts, timeout), NULL) < 0)
b11b5f
+        if (ppoll(pollfds, ELEMENTSOF(pollfds),
b11b5f
+                  timeout == USEC_INFINITY ? NULL : timespec_store(&ts, timeout), NULL) < 0) {
b11b5f
+                if (errno == EINTR)
b11b5f
+                        return 0;
b11b5f
+
b11b5f
                 return log_error_errno(errno, "Couldn't wait for journal event: %m");
b11b5f
+        }
b11b5f
 
b11b5f
         if (pollfds[1].revents & (POLLHUP|POLLERR)) { /* STDOUT has been closed? */
b11b5f
                 log_debug("Standard output has been closed.");