1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

audit: do not complain if kernel lacks audit

When running on a kernel without audit support, systemd currently
writes a mysterious-sounding error to its log:

	systemd[1]: Failed to connect to audit log: Protocol not supported

Better to suppress the audit_open() failure message when (and only
when) it is due to running on a kernel without audit support, since in
this case the admin probably does not mind systemd not writing to the
audit log.  This way, more serious errors like ENOMEM and EACCES will
stand out more.
This commit is contained in:
Jonathan Nieder 2011-10-17 21:01:40 +02:00 committed by Tollef Fog Heen
parent e51db373c2
commit 5a8d081c58
2 changed files with 8 additions and 2 deletions

View File

@ -286,7 +286,10 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
goto fail;
#ifdef HAVE_AUDIT
if ((m->audit_fd = audit_open()) < 0)
if ((m->audit_fd = audit_open()) < 0 &&
/* If the kernel lacks netlink or audit support,
* don't worry about it. */
errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT)
log_error("Failed to connect to audit log: %m");
#endif

View File

@ -376,7 +376,10 @@ int main(int argc, char *argv[]) {
umask(0022);
#ifdef HAVE_AUDIT
if ((c.audit_fd = audit_open()) < 0)
if ((c.audit_fd = audit_open()) < 0 &&
/* If the kernel lacks netlink or audit support,
* don't worry about it. */
errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT)
log_error("Failed to connect to audit log: %m");
#endif