[libvirt] [PATCH 1/7] audit: use bool for audit log choice

Eric Blake eblake at redhat.com
Tue Oct 28 20:34:44 UTC 2014


We weren't ever using the value for anything other than being non-zero.

* src/util/viraudit.h (virAuditLog): Change signature.
* src/util/viraudit.c (virAuditLog): Update user.
* daemon/libvirtd.c (main): Likewise.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 daemon/libvirtd.c   | 2 +-
 src/util/viraudit.c | 4 ++--
 src/util/viraudit.h | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 329d8d4..1864bfd 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1443,7 +1443,7 @@ int main(int argc, char **argv) {
             VIR_DEBUG("Proceeding without auditing");
         }
     }
-    virAuditLog(config->audit_logging);
+    virAuditLog(config->audit_logging > 0);

     /* setup the hooks if any */
     if (virHookInitialize() < 0) {
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 23928fd..17e58b3 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -53,7 +53,7 @@ VIR_LOG_INIT("util.audit");
 #if WITH_AUDIT
 static int auditfd = -1;
 #endif
-static int auditlog = 0;
+static bool auditlog;

 int virAuditOpen(void)
 {
@@ -70,7 +70,7 @@ int virAuditOpen(void)
 }


-void virAuditLog(int logging)
+void virAuditLog(bool logging)
 {
     auditlog = logging;
 }
diff --git a/src/util/viraudit.h b/src/util/viraudit.h
index 8101e50..861cbf6 100644
--- a/src/util/viraudit.h
+++ b/src/util/viraudit.h
@@ -1,7 +1,7 @@
 /*
  * viraudit.h: auditing support
  *
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2011, 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@ typedef enum {

 int virAuditOpen(void);

-void virAuditLog(int enabled);
+void virAuditLog(bool enabled);

 void virAuditSend(virLogSourcePtr source,
                   const char *filename, size_t linenr, const char *funcname,
-- 
1.9.3




More information about the libvir-list mailing list