]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: handle inotify exhaustion nicer
authorKevin Kuehler <keur@ocf.berkeley.edu>
Tue, 19 Jun 2018 20:56:36 +0000 (13:56 -0700)
committerLennart Poettering <lennart@poettering.net>
Thu, 21 Jun 2018 12:46:53 +0000 (14:46 +0200)
Instead of failing, log that inotify wds
are exhausted and fallback to -n switch.

Fixes #1296.

src/journal/journalctl.c

index 2773d8554a9ed92874058399544fe66f86cf6a2a..56b1be530d6ca264a87899aa5d700a90ac57bfd5 100644 (file)
@@ -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;
                 }