]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
audit: only check for CAP_AUDIT_WRITE once, during initialization
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 3 Jul 2015 15:57:28 +0000 (16:57 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 6 Aug 2015 16:12:40 +0000 (17:12 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
bus/audit.c

index 1aa1e1845af33a0c22a297e5c24be7ed156a4e38..98f7d7b7303b5b8e5e45d404b7b51b9f95a43e6c 100644 (file)
@@ -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