diff options
author | Dan Winship <danw@redhat.com> | 2015-08-07 16:43:11 -0400 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-08-07 16:46:33 -0400 |
commit | 578e5e53c0882717a76d4d5496364b087999c234 (patch) | |
tree | 94aaad4bd6bed5a752b2c215e546d5d15219d688 /src/nm-audit-manager.c | |
parent | 0db81e10145a55e0e17af28baeba91e5167aac12 (diff) | |
download | NetworkManager-578e5e53c0882717a76d4d5496364b087999c234.tar.gz |
core: fix runtime warning when building without libaudit
If !HAVE_LIBAUDIT then sizeof(NMAuditManagerPrivate) was 0, which
upset g_type_class_add_private(). (It's also not valid C.)
Fix things up so that NMAuditManagerPrivate as a whole only exists if
HAVE_LIBAUDIT.
Diffstat (limited to 'src/nm-audit-manager.c')
-rw-r--r-- | src/nm-audit-manager.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nm-audit-manager.c b/src/nm-audit-manager.c index bc870128b7..eb9bed171b 100644 --- a/src/nm-audit-manager.c +++ b/src/nm-audit-manager.c @@ -50,14 +50,14 @@ typedef struct { AuditBackend backends; } AuditField; -typedef struct { #if HAVE_LIBAUDIT +typedef struct { NMConfig *config; int auditd_fd; -#endif } NMAuditManagerPrivate; #define NM_AUDIT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_AUDIT_MANAGER, NMAuditManagerPrivate)) +#endif G_DEFINE_TYPE (NMAuditManager, nm_audit_manager, G_TYPE_OBJECT) @@ -136,13 +136,16 @@ static void nm_audit_log (NMAuditManager *self, GPtrArray *fields, const char *file, guint line, const char *func, gboolean success) { +#if HAVE_LIBAUDIT NMAuditManagerPrivate *priv; +#endif char *msg; g_return_if_fail (NM_IS_AUDIT_MANAGER (self)); - priv = NM_AUDIT_MANAGER_GET_PRIVATE (self); #if HAVE_LIBAUDIT + priv = NM_AUDIT_MANAGER_GET_PRIVATE (self); + if (priv->auditd_fd >= 0) { msg = build_message (fields, BACKEND_AUDITD); audit_log_user_message (priv->auditd_fd, AUDIT_USYS_CONFIG, msg, @@ -364,7 +367,9 @@ nm_audit_manager_class_init (NMAuditManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); +#if HAVE_LIBAUDIT g_type_class_add_private (klass, sizeof (NMAuditManagerPrivate)); +#endif /* virtual methods */ object_class->dispose = dispose; |