The audit module is initialized every time a new BusContext is created,
which is only once in the real dbus-daemon, but can happen several times
in some unit tests.
Signed-off-by: Simon McVittie <smcv@collabora.com>
#ifdef HAVE_LIBAUDIT
int i;
+ if (audit_fd >= 0)
+ return;
+
capng_get_caps_process ();
/* Work around a bug in libcap-ng < 0.7.7: it leaks a fd, which isn't
bus_audit_shutdown (void)
{
#ifdef HAVE_LIBAUDIT
- audit_close (audit_fd);
+ if (audit_fd >= 0)
+ {
+ audit_close (audit_fd);
+ audit_fd = -1;
+ }
#endif /* HAVE_LIBAUDIT */
}