From 575974e23bece9995ddbd37cf690edab57f88dc6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 3 Jul 2015 16:57:28 +0100 Subject: [PATCH] audit: only check for CAP_AUDIT_WRITE once, during initialization Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225 Signed-off-by: Simon McVittie --- bus/audit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bus/audit.c b/bus/audit.c index 1aa1e18..98f7d7b 100644 --- a/bus/audit.c +++ b/bus/audit.c @@ -52,6 +52,11 @@ void bus_audit_init (BusContext *context) { #ifdef HAVE_LIBAUDIT + capng_get_caps_process (); + + if (!capng_have_capability (CAPNG_EFFECTIVE, CAP_AUDIT_WRITE)) + return; + audit_fd = audit_open (); if (audit_fd < 0) @@ -83,11 +88,6 @@ bus_audit_get_fd (void) #ifdef HAVE_LIBAUDIT if (audit_fd >= 0) { - capng_get_caps_process (); - - if (!capng_have_capability (CAPNG_EFFECTIVE, CAP_AUDIT_WRITE)) - return -1; - return audit_fd; } #endif -- 2.1.4