summaryrefslogtreecommitdiff
path: root/src/update-utmp
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-04-13 17:17:56 +0200
committerLennart Poettering <lennart@poettering.net>2012-04-13 18:52:53 +0200
commit44785992c3c32e6abbf9d9345e0d68d579ef165b (patch)
tree2a453023bb42d633a106a805380cab24e943e778 /src/update-utmp
parent2c3ff76eb004d71a70cb5e253cbca7332c53ac09 (diff)
audit: ignore if we get EPERM
if auditing access is not available, then don't complain about it, in order to play nice with systems lacking CAP_SYS_AUDIT
Diffstat (limited to 'src/update-utmp')
-rw-r--r--src/update-utmp/update-utmp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index ec07b9212..ee9105bf4 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -250,7 +250,8 @@ static int on_reboot(Context *c) {
#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;
}
@@ -278,7 +279,8 @@ static int on_shutdown(Context *c) {
#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;
}
@@ -330,7 +332,8 @@ static int on_runlevel(Context *c) {
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;
}