}
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. */
-
+ * Then let's not retry again. */
audit_close(m->audit_fd);
m->audit_fd = -1;
- }
+ } else
+ log_warning("Failed to send audit message: %m");
}
free(p);
#ifdef HAVE_AUDIT
if (c->audit_fd >= 0)
- if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "init", NULL, NULL, NULL, 1) < 0) {
+ if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "init", NULL, NULL, NULL, 1) < 0 &&
+ errno != EPERM) {
log_error("Failed to send audit message: %m");
r = -errno;
}
#ifdef HAVE_AUDIT
if (c->audit_fd >= 0)
- if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "init", NULL, NULL, NULL, 1) < 0) {
+ if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "init", NULL, NULL, NULL, 1) < 0 &&
+ errno != EPERM) {
log_error("Failed to send audit message: %m");
r = -errno;
}
runlevel > 0 ? runlevel : 'N') < 0)
return -ENOMEM;
- if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_RUNLEVEL, s, NULL, NULL, NULL, 1) < 0) {
+ if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_RUNLEVEL, s, NULL, NULL, NULL, 1) < 0 &&
+ errno != EPERM) {
log_error("Failed to send audit message: %m");
r = -errno;
}