From: Simon McVittie Date: Fri, 3 Jul 2015 15:57:28 +0000 (+0100) Subject: audit: only check for CAP_AUDIT_WRITE once, during initialization X-Git-Tag: dbus-1.9.20~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2602ca61c542280afff66c397172ebe951d28e74;p=thirdparty%2Fdbus.git audit: only check for CAP_AUDIT_WRITE once, during initialization Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225 Reviewed-by: Colin Walters Signed-off-by: Simon McVittie --- diff --git a/bus/audit.c b/bus/audit.c index 1aa1e1845..98f7d7b73 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