summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-07-03 16:57:28 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-08-06 17:12:40 +0100
commit2602ca61c542280afff66c397172ebe951d28e74 (patch)
treeb0d3543672e39acd44fada3915e6bfc61eb5a5d4
parente3e388a1ef8859cfb672bd92d955ce90aafb7f7d (diff)
downloaddbus-2602ca61c542280afff66c397172ebe951d28e74.tar.gz
audit: only check for CAP_AUDIT_WRITE once, during initialization
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>
-rw-r--r--bus/audit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bus/audit.c b/bus/audit.c
index 1aa1e184..98f7d7b7 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