summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Kuehler <keur@ocf.berkeley.edu>2018-06-19 13:56:36 -0700
committerLennart Poettering <lennart@poettering.net>2018-06-21 14:46:53 +0200
commit321ed3643a898bcd736cee610209d1671ce8a0f9 (patch)
tree2b419914681300b1256d9369b7392d94456e32b7 /src
parentfee854ee8ccde0cd28e0f925dea18cce35f3993d (diff)
journalctl: handle inotify exhaustion nicer
Instead of failing, log that inotify wds are exhausted and fallback to -n switch. Fixes #1296.
Diffstat (limited to 'src')
-rw-r--r--src/journal/journalctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 2773d8554a..56b1be530d 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -2392,11 +2392,13 @@ int main(int argc, char *argv[]) {
/* Opening the fd now means the first sd_journal_wait() will actually wait */
if (arg_follow) {
r = sd_journal_get_fd(j);
- if (r == -EMEDIUMTYPE) {
+ if (r == -EMFILE) {
+ log_warning("Insufficent watch descriptors available. Reverting to -n.");
+ arg_follow = false;
+ } else if (r == -EMEDIUMTYPE) {
log_error_errno(r, "The --follow switch is not supported in conjunction with reading from STDIN.");
goto finish;
- }
- if (r < 0) {
+ } else if (r < 0) {
log_error_errno(r, "Failed to get journal fd: %m");
goto finish;
}