summaryrefslogtreecommitdiff
path: root/src/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-14 17:48:34 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-14 17:48:48 +0100
commit391ade86065cb56e9f4bec0c21f2e22ec7880369 (patch)
tree23715091bbc188d6714489667764c6ae1df3c456 /src/manager.c
parent3bd66c05d5d775a82768e0772c83a7300baee366 (diff)
audit: give up sending auditing messages when it failed due to EPERM
Diffstat (limited to 'src/manager.c')
-rw-r--r--src/manager.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/manager.c b/src/manager.c
index 1ab4c94ee..cee434466 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2448,8 +2448,19 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
return;
}
- if (audit_log_user_comm_message(m->audit_fd, type, "", p, NULL, NULL, NULL, success) < 0)
- log_error("Failed to send audit message: %m");
+ if (audit_log_user_comm_message(m->audit_fd, type, "", p, NULL, NULL, NULL, success) < 0) {
+ log_warning("Failed to send audit message: %m");
+
+ if (errno == EPERM) {
+ /* We aren't allowed to send audit messages?
+ * Then let's not retry again, to avoid
+ * spamming the user with the same and same
+ * messages over and over. */
+
+ audit_close(m->audit_fd);
+ m->audit_fd = -1;
+ }
+ }
free(p);
#endif