dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
923a60
From a81ba5e1bfabf643e11fec41c1ce646874ae0df1 Mon Sep 17 00:00:00 2001
923a60
From: Lennart Poettering <lennart@poettering.net>
923a60
Date: Wed, 20 May 2015 14:37:21 +0200
923a60
Subject: [PATCH] journald: handle more gracefully when bind() fails on audit
923a60
 sockets
923a60
923a60
(cherry picked from commit 417a7fdc418ec76cc4c321c9a07ec15c72b3ac7d)
923a60
923a60
Cherry-picked from: 417a7fd
923a60
Resolves: #1222517
923a60
---
923a60
 src/journal/journald-audit.c | 11 ++++++++---
923a60
 1 file changed, 8 insertions(+), 3 deletions(-)
923a60
923a60
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
923a60
index 46eb82fa34..0e739a23af 100644
923a60
--- a/src/journal/journald-audit.c
923a60
+++ b/src/journal/journald-audit.c
923a60
@@ -532,9 +532,14 @@ int server_open_audit(Server *s) {
923a60
                         return 0;
923a60
                 }
923a60
 
923a60
-                r = bind(s->audit_fd, &sa.sa, sizeof(sa.nl));
923a60
-                if (r < 0)
923a60
-                        return log_error_errno(errno, "Failed to join audit multicast group: %m");
923a60
+                if (bind(s->audit_fd, &sa.sa, sizeof(sa.nl)) < 0) {
923a60
+                        log_warning_errno(errno,
923a60
+                                          "Failed to join audit multicast group. "
923a60
+                                          "The kernel is probably too old or multicast reading is not supported. "
923a60
+                                          "Ignoring: %m");
923a60
+                        s->audit_fd = safe_close(s->audit_fd);
923a60
+                        return 0;
923a60
+                }
923a60
         } else
923a60
                 fd_nonblock(s->audit_fd, 1);
923a60